Jump to content
Macro Express Forums

Set repeat amount from prompt


NeVeR
 Share

Recommended Posts

I've a list of numbers that i'd like to copy.

 

Each number is on it's own line in a spread sheet.

 

I'd like each number once copied to be give a %T1% and then %T2% for the second and so on. So each number has it's own %T% number.

 

The list of numbers i've to copy changes all the time. So when i start the marco i'd like to get a prompt saying "How many times to repeat" I'd enter a value and then the macro would know how many times to run.

 

I'm sure I can get this part done ( I hope )

 

It's the setting each copied number to it's own %T% that i can't figure out.

 

I know i could do this the long way of just duplicating a command 10 or 20 times in ME and then repeating it by hand .. but i don't really want to as i'm sure there is a way around it.

 

 

Any idea ?

 

What i have so far is

 

Set Var Interger %N!% from prompt // I will enter the repeat amounts here

Repeat with Var using N1 / repeat will start.

Clipboard copy

Var set string %T!% from clipboard -------------- How do i get this part to move to %T2% and then %T3% etc each new time the repeat is run ?

 

there is more to it but this is the main part i'm stuck on.

 

thanks.

Link to comment
Share on other sites

There is an example of using a integer variable to index string variables in the Variable Evaluation Level article in the July 2005 issue of the Macro Express News email newsletter. That article refers to a Variable Evaluation Level sample macro.

 

I think it says to use something like %T%N1%% but you may have to change the Variables Evaluation Level setting from 0 to 1 in the preferences. To get there open preferences, click Miscellaneous and then the Advanced button.

Link to comment
Share on other sites

  • 3 weeks later...
Set Var Integer %N1% from prompt // I will enter the repeat amounts here
Set Var Integer %N99% = 1 // This is the counter

Repeat %N1% times
   Clipboard copy
   Var set string %T%N99%% from clipboard // Example: When %N99% = 1, the value of %T%N99%% is %T1%
   %N99% = %N99% + 1 // Increment by 1
End Repeat

// To paste out the values:

Set Var Integer %N99% = 1 // Reset the counter to 1
Repeat %N1% times
    Type Text %T%N99%% 
    // Move the cursor to the next location, e.g., Type Text <TAB> , Type Text <ENTER>, or whatever
   %N99% = %N99% + 1
End Repeat

 

Link to comment
Share on other sites

  • 1 year later...

I have been trying to do EXACTLY this, without success. Where would I paste your code in MacroExpress?

 

Set Var Integer %N1% from prompt // I will enter the repeat amounts here
Set Var Integer %N99% = 1 // This is the counter

Repeat %N1% times
   Clipboard copy
   Var set string %T%N99%% from clipboard // Example: When %N99% = 1, the value of %T%N99%% is %T1%
   %N99% = %N99% + 1 // Increment by 1
End Repeat

 

The only option I can seem to find is 'Variable Set String' - however it forces you to pick from a dropdown list of T variables. Just need help how to get this command working: Var set string %T%N99%% from clipboard

 

Thank you!

Link to comment
Share on other sites

Great reason to upgrade then! Just bought Macro Express Pro.

 

However, my variables now show up like this: %T[99]% (note the brackets) whereas in MEX3 it would've appeared as %T99%. Is the bracketing required? I don't see it in your code:

 

Var set string %T%N99%% from clipboard

 

If not required, curious why all of my variables now have it when opened in MEXPro. Thanks

 

 

[uPDATE: I figured it out. The brackets were required. Guessing either the brackets were added after your original post date, or you excluded them for clarity reasons. Either way, this post was very helpful so thanks!]

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

×
×
  • Create New...