ffortino Posted August 3, 2004 Report Share Posted August 3, 2004 Hi, Is it possible to process a group of text (T) vars as an array, with a for loop and an index?? Thanks, Quote Link to comment Share on other sites More sharing options...
Pete Posted August 3, 2004 Report Share Posted August 3, 2004 Hi ffortino, I don't believe so. One way to get round this would be to append all the T variables to a file (CRLF after each one), then process the file using TEXT FILE BEGIN PROCESS. This would process one value at a time in a loop. Maybe you could populate the file instead of the T variables initially ? Pete. Quote Link to comment Share on other sites More sharing options...
joe Posted August 3, 2004 Report Share Posted August 3, 2004 Hello ffortino! There are no arrays in Macro Express, but a linear sequence of variable numbers can be stepped through like an array. The following code stuffs string variables T1 through T99 with values from the Registry. Is this what you are thinking about? We do this in several areas of our PGM Functions Library. Repeat Start (Repeat 99 times) Read Registry String: "T%N1%" Repeat End And there are other sophisticated ways of handling variables such as using dynamic macros. VarLoop.zip Quote Link to comment Share on other sites More sharing options...
aoz Posted July 26, 2007 Report Share Posted July 26, 2007 Is this method available in macro express itself? I am trying to read in lines from a file, and fill sequential variables from those lines. BUT, the "variable from file" method, just fills in T1 (or whqatever I start with), doesn't do anhy sequential fill, because each line is just a line, not any csv delimited setup. Any way to read LINES in from a file, to sequential variables? Line 1 goes to T1, line 2 goes to t2, etc? thanks NIck Quote Link to comment Share on other sites More sharing options...
kevin Posted July 26, 2007 Report Share Posted July 26, 2007 In order for this example to work you need to set the 'Variables Evaluation Level' to 1 or larger. If you are using Macro Express v 3.7 or later you can set this by clicking Options, Preferences, Miscellaneous and then the Advanced button. For v 3.6 and prior, download TweakME3.mxe from the More Macro Express Downloads page and run it to change the 'Variables Evaluation Level'. Something like this should work: // Initialize N1 to 10 so first line is copied to variable T10 Variable Set Integer %N1% to 10 // Initialize N2 used for counter Variable Set Integer %N2% to 10 Text File Begin Process: "test.txt" // Do not exceed the number of available variables (T99 is the last variable) If Variable %N2% > 99 Break Else // The next two commands copy T1 to T%N1% Variable Set String %T2% "<TMVAR2:09:%N1%:01:000:000:>" Run Macro in Variable %T2% End If // Increment the counter Variable Modify Integer: Inc (%N2%) Text File End Process // Here: Variable T10 through up to T99 contain contents of the file c:\test.txt Quote Link to comment Share on other sites More sharing options...
mcZenner Posted July 27, 2007 Report Share Posted July 27, 2007 Hey this is cool... but I'd like to use it directly in functions such as RepeatWithFolder (as the variable for "Place Name In" ... "T%N1%" ) instead of through assignment, it would be nice to have a native use of it 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.