Jump to content
Macro Express Forums

Saving the value of a variable for "next time"


Recommended Posts

I am calling up a multiple choice window. I've set up a default assignment of the "choice" variable within the multiple choice window so that, when the multiple choice window appears, a specific button is preselected (as the default); in other words, I assign a value to the choice variable (say "A") before the multiple choice window appears, causing the button by choice "A" to be preselected.

 

Now, if I actually wish to make another choice, I can of course click on another multiple choice button, say button "B".

 

What I am looking for is for the new choice to become the new default, so that, when I run the macro again, the preselected button will be "B", not "A". I know I can get this effect by saving that assignment to a text file, and then when I run the macro again have the "choice" variable assigned by reading the content of that text file - in effect, the default button becomes the button that was selected the last time I ran the macro. Fine, no problem.

 

But rather than populating my disk with such "ini" files of sorts, or making one huge ini file to store all such settings, I wonder if it is possible to change the static assignment of a variable within the macro to reflect the choice made in the multiple choice window. As it is, I define the default "choice" like this:

 

>>

Variable Set String %printJob% to "A"

Multiple Choice Menu: Make EPS files

<<

 

In the Multiple Choice Menu, button "A" will now be preselected. But is there any way to pass the value "B" to the Variable Set String command, if I chose button B in the multiple choice menu, and have that new value saved somehow inside the macro to function as the new default next time I run the macro?

 

Hm...

Link to post
Share on other sites

I don't think there's any reasonable way to modify the macro every time like you suggest. What I do is to use the registry like every other Windows program. Super easy to do and really the proper way to do tings like this.

Link to post
Share on other sites

Yes, this is possible. But it requires a technique that may be more complicated than using .INI files or the registry.

 

Macro Express has the ability to run a macro that is contained in a text macro file. The text macro file can be modified by Macro Express or by another separate process. To set this up do the following:

  • Create new macro
  • Put Variable Set String %printJob% to "A" in it
  • Click View and Direct Editor
  • Copy the macro command
  • Paste into a text file. I would save it in the same folder where your other macro files are located.

This gives a sample of the ASCII text syntax for the macro command.

 

In your macro that contains the Multiple Choice Menu command put in a Load Macro Text File file command using the path to the text file you created above.

 

Now, as your regular macro runs you can modify the text macro file to set %printJob% to B or some other value as needed.

 

You can put as much or as little of your macro into the separate text macro file as you wish. This requires a separate text macro file, not much different than having an INI file.

 

I would just create an .INI file in the Temp folder (use %TEMP% in the path) and save the variables in it. Many programs store stuff in the Temp folder.

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

Guest
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.

Loading...
×
×
  • Create New...