Jump to content
Macro Express Forums

Subtract one number?

Recommended Posts


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.


Link to comment
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. 

Link to comment
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.

Link to comment
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
<VARIABLE SET INTEGER Option="\x0C" Destination="%Value%"/>
<VARIABLE MODIFY INTEGER Option="\x01" Destination="%Result%" Value1="%Value%" Value2="1"/>


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...