Jump to content
Macro Express Forums

Add Loop


Recommended Posts

I have a decimal interger outside of a loop something like this.


decimal interger



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


Link to comment
Share on other sites



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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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


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

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.

  • Create New...