Jump to content
Macro Express Forums

Pasting text from a rotating list of variables?


Recommended Posts

I didn't remember that setting. My more "brute-force" method works, but I would prefer to use nested variables. Just an aesthetic choice.

 

Something I find irritating about all of the script samples I've submitted in this thread: The variables get assigned every single time the macro runs. I would rather they get assigned once.

 

If I were doing this again, I would use two scripts: the first script to load the variables into memory. You'd only need to trigger it once, at the start of a session. The variables would persist while Macro Express is running.

 

The second script outputs the variables... and that's all it does, other than iterate the counter.

Link to comment
Share on other sites

  • 2 weeks later...

I tried to add a way to make the different texts (N1) start off with a random one on the first run of the day, rather than start at the first one every day. I made an If variable loop where if N2 is = 1 then it would change N1 to a random number, then increment N2 so that that loop won't run again. The problem is I can't get it to run at all, or it will run every time depending on if it happens before the Restore all variables line or after. Any ideas on what I'm doing wrong?

code.png

Link to comment
Share on other sites

I believe an integer variable will have the value zero if there have been no previous commands setting a value.  Therefore N2 will NEVER be equal to 1, and the macro will NEVER set N1 to a random value -- at least the way the macro stands now. 

 

If you PREVIOUSLY set N2=1, and saved and restored variables every time the macro ran, then N2=1 would be true once and only once, and "never" again.  But shutting down and restarting Macro Express would wipe out saved variables and you would be back to the original state where N2 will NEVER equal 1.  And some unrelated macro, assuming you have some, could change the value of N2, then save variables, and this macro would pick up that saved value, whether it be 0 or 1 or 987654. 

 

Try making a second macro whose only function is to set N2=1 and save variables.  Run that macro once at the beginning of each day, and I think it will make the random feature work the way you want it to. 

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.

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