How Can We Help?
< All Topics

How do I set an integer variable and have that value increment each macro run?

The first step is to create a .txt file with your starting value and save the file. The macro will read the value from the file and when finished increment the value by one. The next time the macro is run, it reads the new value which is one greater than the last time the macro ran.

Below is an example of the steps needed and a description of what each step does.

1. Variable Set String %T1% from File: “increment.txt”
2. Variable Modify String: Convert %T1% to integer %N1%
3. Variable Modify Integer: Inc (%N1%)
4. Variable Modify Integer: Convert %N1% to text string %T1%
5. Variable Modify String: Save %T1% to Text File

Step one extracts the value from the .txt file and saves it to a variable such as T1. The next step converts the variable to an Integer variable. Step 3 increments the value by one. The fourth step converts the value back to a text string variable. And the last step saves the new incremented value to the original text file.

– Applies to: Macro Express and Macro Express Pro