koden Posted March 14, 2006 Report Share Posted March 14, 2006 I use T variables, when i have something to copy and paste again in same macro. But if I want to have a permanent text to use in dif. macros, what can I then use??? I have looked in help, but i'm not sure what to use. Quote Link to comment Share on other sites More sharing options...
jason Posted March 14, 2006 Report Share Posted March 14, 2006 You could use the Variable Modify String command to save the variable to a text file. This is found under the Option 2 Tab of the command. You could then use the Variable set String command in other macros to load the information from the text file into your variable. Quote Link to comment Share on other sites More sharing options...
lemming Posted March 14, 2006 Report Share Posted March 14, 2006 Variables are not stored between different macros, i.e. there are no "global" variables. That is one of the major weaknesses in Macex. You can use the Variable Save command to do what you need. However, it is a really kludgy solution. For example, if you have two macros and want to pass data back and forth. Basically, you need to issue a variable save command in the first macro. Then you issue a variable restore command in the second macro. To pass data from the second to first macro, you reverse the process. In addition, the variable save/restore command has its own limitations. You can only save/restore all text variables at once, which means you have to be careful when you restore because it will overwrite all existing variables from T1 to T99. Like I said, a real kludge. Quote Link to comment Share on other sites More sharing options...
jason Posted March 14, 2006 Report Share Posted March 14, 2006 The Variable Save and Variable Restore commands will only work if you do not run another macro in between the macros that use variable commands, and you do not shut Macro Express down in between the macros. The variable values are all set to 0 when Macro Express is restarted or a macro is run using the variable commands. Quote Link to comment Share on other sites More sharing options...
kevin Posted March 14, 2006 Report Share Posted March 14, 2006 There are a variety of ways to save and restore variables. In memory via the Variable Save/Restore commands. In one or more .ini files. In environment variables In one or more text files. For example: // Save / restore all text variables (%Tx%) Variable Save Text Variables Variable Restore Text Variables // Save / restore all variables Variable Save All Variables Variable Restore All Variables // Save / restore a single variable using an .INI file Variable Modify String: Save %T1% to INI File Variable Set String %T1% from INI File // Save / restore a single variable using the environment variables Variable Modify String: Save %T1% to Environment Variable Variable Set String %T1% from Environment Variable // Save / restore a single variable using a text file Variable Modify String: Save %T1% to Text File Variable Set String %T1% from File: "T1" Quote Link to comment Share on other sites More sharing options...
koden Posted March 15, 2006 Author Report Share Posted March 15, 2006 Hello thanks Extra question: When the T variable has been used/pasted, is the T variable then empty?? Or will the T variabel hold the text until the macro stops?? I ask because 1 of the variable I have to use twice when the macro runs. Quote Link to comment Share on other sites More sharing options...
jowensii Posted March 16, 2006 Report Share Posted March 16, 2006 Once you set the value of an ME variable, ME will remember the value until the macro exits. Quote Link to comment Share on other sites More sharing options...
koden Posted March 17, 2006 Author Report Share Posted March 17, 2006 Thanks...stupid question I made here. I have just tested it. And ypu are right.. :-)) Sorry.. 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.