Jump to content
Macro Express Forums
MoneyJ3rk

Subtract one number?

Recommended Posts

Hi! 

I've tried for several hours now to create a macro that can subtract one number of the current one that's in the highlighted field.

Example: "500" is the highlighted number, and I want to execute the macro and subtract the number by 1 so it becomes 499 (the field is in the picture)

Anyone please have any starters on how to create this? Tried with several integer variables.

 

Sorry for my english.

highlighted.PNG

Share this post


Link to post
Share on other sites

Use Variable Modify Integer to subtract. It's very simple.

Maybe your problem is that you don't have an integer to begin with. Are you starting with text? Remember, just because you see "500" doesn't mean it's an integer. That's actually a string data type representing a number. You need to cast it to a integer data type before you can perform integer operations on it. Try Variable Modify String with the Convert to Integer method. 

Share this post


Link to post
Share on other sites

Thanks for the reply Cory!

I'm quite the newbie with strings and variables, and the tutorials dosn't cover what i'm trying to do.

Could you help me with how the code would look like? 

 

I'm starting off with highlighting the number that I want to subtract one off, then  I want the macro to subtract one number off the highlighted number.

I tried with Variable Modify Integer: %Subtract[1]% and im kinda lost on ( value 1 and 2) and how to connect the variable and integer and which one to use.

Share this post


Link to post
Share on other sites

This may get you started. This assumes the number in the field is highlighted.

Clipboard Copy
Variable Set Integer %Value%: Set to the Clipboard Value
Variable Modify Integer: %Result% = %Value% - 1
<CLIPBOARD COPY/>
<VARIABLE SET INTEGER Option="\x0C" Destination="%Value%"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%Result%" Value1="%Value%" Value2="1"/>

 

Share this post


Link to post
Share on other sites

Thanks for the reply Samarae!

Does the picture look like you described it?

Doesn't change the value on the highlight.

 

I might be doing something wrong:)

Edit: Did add Clipboard Paste at the end, still nothing.

subtract.PNG

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×