Cartwheels Posted September 9, 2009 Report Share Posted September 9, 2009 Do I need to clear varibles at the beginning of my macros so they don't accidently get recycled? In other words do the varibles get carried over from the last time they were run? I had a macro do something kind of odd, so I'm trying to figure out why it did what it did. Quote Link to comment Share on other sites More sharing options...
Brain Virus Posted September 9, 2009 Report Share Posted September 9, 2009 Do I need to clear varibles at the beginning of my macros so they don't accidently get recycled? In other words do the varibles get carried over from the last time they were run? I had a macro do something kind of odd, so I'm trying to figure out why it did what it did. You dont have to if you define all the macros in the variable. but depending on the situation like if you are appending to another variable then yes you do <CLEARVAR1:A:ALL> clears all variable If you explain what happens and maybe post some of the code we can look through it and try to figure it out. Quote Link to comment Share on other sites More sharing options...
Brain Virus Posted September 9, 2009 Report Share Posted September 9, 2009 sorry double post. Quote Link to comment Share on other sites More sharing options...
rberq Posted September 10, 2009 Report Share Posted September 10, 2009 This has always been a fuzzy area for me, if only because I can't find a clear description in the Help system. But here's an experiment. Consider the following macro: Text box display %T1% %T2% %T3% Variable set string T1 = a Variable set string T2 = b Variable set string T3 = c Text box display %T1% %T2% %T3% Every time you run it, the first display will be blank (no values) and the second display will be "a b c". So, it appears that variables have no value carried over from previous macro executions. Now run a second macro consisting solely of Text box display %T1% %T2% %T3% Every time you run it, the display will be blank (no values). That is true even if you run the first macro and then the second -- the display will still be blank. Now, add "Save all variables" to the end of the first macro, and "Restore all variables" to the beginning of the second macro. Run the first macro followed by the second. The first display from the first macro will always be blank. The second display from the first macro will be "a b c". The (only) display from the second macro will be "a b c". So it appears that all variables are empty by default when a macro begins, and values set within a macro are discarded when the macro ends, UNLESS save and restore are used. The exception to this rule is, when the MACRO RUN command is used to call one macro from within another, the called macro automatically inherits all values existing in the caller. Saved variable values do not survive a shutdown and restart of Macro Express. I only tested with text variables. You could extend the test to include decimals and integers. My guess is that they act the same way. Quote Link to comment Share on other sites More sharing options...
kevin Posted September 10, 2009 Report Share Posted September 10, 2009 Each variable is cleared when a macro runs. The only exception to this is if one macro calls another via the Macro Run command. In that case all variable values are passed to the called macro. Quote Link to comment Share on other sites More sharing options...
paul Posted September 14, 2009 Report Share Posted September 14, 2009 Each variable is cleared when a macro runs. The only exception to this is if one macro calls another via the Macro Run command. In that case all variable values are passed to the called macro. AND "Wait for this macro to terminate before proceeding" is ticked. Quote Link to comment Share on other sites More sharing options...
kevin Posted September 14, 2009 Report Share Posted September 14, 2009 AND "Wait for this macro to terminate before proceeding" is ticked.That only applies to Macro Express Pro, not Macro Express 3. Quote Link to comment Share on other sites More sharing options...
paul Posted September 15, 2009 Report Share Posted September 15, 2009 That only applies to Macro Express Pro, not Macro Express 3. How very true! I'm simply trying to encourage your users to upgrade to MEP! 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.