MoneyJ3rk Posted December 5, 2018 Report Share Posted December 5, 2018 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. Quote Link to comment Share on other sites More sharing options...
Cory Posted December 5, 2018 Report Share Posted December 5, 2018 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. Quote Link to comment Share on other sites More sharing options...
MoneyJ3rk Posted December 5, 2018 Author Report Share Posted December 5, 2018 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. Quote Link to comment Share on other sites More sharing options...
Samrae Posted December 5, 2018 Report Share Posted December 5, 2018 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"/> Quote Link to comment Share on other sites More sharing options...
MoneyJ3rk Posted December 6, 2018 Author Report Share Posted December 6, 2018 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. Quote Link to comment Share on other sites More sharing options...
MoneyJ3rk Posted December 6, 2018 Author Report Share Posted December 6, 2018 Solved: Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.