jevans Posted April 23, 2006 Report Share Posted April 23, 2006 I have a decimal interger outside of a loop something like this. decimal interger repeat macro repeat end the macro uses the decimal interger. Iv tried using the variable modify decimal ,however the decimal interger resets every time it loops back to the begining. is my repeat setup wrong? iv tried everything..... I exported a macro file if it will help ulysses.mex Quote Link to comment Share on other sites More sharing options...
lemming Posted April 25, 2006 Report Share Posted April 25, 2006 CORRECT INFO IN POST BELOW * Thanks, Jason. Looks like you're using the Macro Run command. Macex variables are not global, so running another macro will result in it having empty variables (reset to zero). You will need to use the Variable Save command to save and restore variables between macros. So, assuming Macro A calls Macro B, you need to: 1) Save variables in Macro A just before calling Macro B. 2) Call Macro B, and when in Macro B, restore variables. To return data to Macro A, you have to reverse the process. This is one of the weaknesses in Macex. Quote Link to comment Share on other sites More sharing options...
jason Posted April 25, 2006 Report Share Posted April 25, 2006 Actually lemming, that information is incorrect. When you set up a variable in a parent macro, that same value is used in all submacros. And, any changes you make in the submacro are propagated to the parent macro. What you're suggesting is a way to make sure that the variables are not modified when you call the submacro. And, in this way, it's not a weakness. jevans, I took a look at your macro and it's not quite set up the way you described in your message. It looks like you have two "Macro Run" commands inside of your loop. Also, there was no "Variable Set Decimal" command in the parent macro. That means that it exists in one of the two child macros and as such, is going to be reset each time that macro is called. In your post, the suggested setup would work perfectly, as long as you don't reset the %D1% variable in your submacros. Quote Link to comment Share on other sites More sharing options...
lemming Posted April 25, 2006 Report Share Posted April 25, 2006 Whoops, my bad. I had always thought variables had to be saved for passing to another macro. Looks like I'll need to rewrite some of my macros. Perhaps the documentation could clarify this in the future. From reading the helpfile, I got the impression these steps were mandatory. Quote Link to comment Share on other sites More sharing options...
jevans Posted April 25, 2006 Author Report Share Posted April 25, 2006 Cool, thanks for the help thus far. The only thing i forgot to add is the variable modify decimal add. I just need the interger to increment by .025 steps after every loop... thats where my problems started. Where should I place the modify decimal add @. Sorry the file I sent was me expirimenting repeat2.mex Quote Link to comment Share on other sites More sharing options...
jevans Posted April 25, 2006 Author Report Share Posted April 25, 2006 This is the macro with that recieves the decimal set_delay.mex Quote Link to comment Share on other sites More sharing options...
jevans Posted April 25, 2006 Author Report Share Posted April 25, 2006 and heres is the rest of the macro thanks for the support, ill have my company purchase the software direct.mex 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.