|
Post by Chaba on Nov 16, 2019 22:15:13 GMT
Is there a way to print the loop iteration? For example, lets say I set the loop to 10 and on the fifth time through I want Mini Mouse to print/keypress "4" (or 5 if iteration starts on 1, it doesn't really matter). I would prefer this method because I must change the loop number often.
|
|
|
Post by Steve on Nov 17, 2019 3:17:49 GMT
Hi Chaba, I think i know what your after, the %I% variable from a FOR loop ( www.turnssoft.com/conditions.html#for). FOR loops add several internal Mini Mouse Macro variables that can be used for evaluation. These are: %I%: The count for the current iteration of the FOR loop %LINE%: Used in FOR EACH LINE loops, this variable holds the current text line in a file %FILE%: The full file path and name of the current FOR EACH FILE loop file %FILE.NAME%: The file name of the current FOR EACH FILE loop file %FILE.EXT%: The file extension of the current FOR EACH FILE loop file. For example this may be .txt or .rtf %FILE.PATHROOT%: The root of the file path for the current FOR EACH FILE loop file %FILE.PATH%: The file path without the file name of the current FOR EACH FILE loop file %FILE.ACCESSTIME%: The last file access time of the current FOR EACH FILE loop file %FILE.WRITETIME%: The last file write time of the current FOR EACH FILE loop file %FILE.CREATIONTIME%: the file creation time of the current FOR EACH FILE loop file Consider this example below. This simple example loops through each file within the D:\Macro\TX directory sequentially providing the loop count ( %I%) and the file name and path ( %FILE%) in a message box: 1 | FOR | EACH | FILE IN | D:\Macro\TX | DO 2 | RUN ACTION | MESSAGE PROMPT | Loop %I% and File %FILE%::Loop and File::0 3 | FOR | NEXT This next example adds to the first by nesting another for loop to count the total amount of lines in each file. It assigns the line count to the variable %INTEGER%: 1 | FOR | EACH | FILE IN | D:\Macro\TX | DO 2 | FOR | EACH | LINE IN | %FILE% | DO 3 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::+1 4 | FOR | NEXT 5 | RUN ACTION | MESSAGE PROMPT | Loop %I% and File %FILE% has %INTEGER% lines ::Loop, File, and Count::0 6 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::0 7 | FOR | NEXT
|
|
|
Post by Chaba on Nov 18, 2019 22:45:19 GMT
Thanks for the reply! I don't think this is quite what I was looking for though.
In simplest form, how could I set the loop count (in the top right corner of Mini Mouse) to "6" and have the program print (in wordpad, for example) "012345"?
Something like: 1 | 100 | 100 | 100 | Keypress %I%
This doesn't work though, I assume because %I% is the iteration of a FOR loop, not the built-in loop function of the program. Is it possible to reference the built-in loop function? Thanks in advance!
|
|
|
Post by zeak on Nov 20, 2019 21:20:18 GMT
Try this Chaba,
1 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::1 2 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1%::10 3 | FOR | I | = | %INTEGER% TO %INTEGER1% | NEXT 4 | RUN ACTION | SELECT WINDOW BY NAME | Untitled - Notepad 5 | X | X | 100 | Keypress %INTEGER% 6 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::+1 7 | FOR | NEXT
|
|
|
Post by Chaba on Nov 20, 2019 21:53:51 GMT
Thanks Zeak, but that doesn't key to the built-in loop. I would like to reference the built-in loop function (in the top right corner of the application) so that the upper limit will be equal to that built-in loop. If I set the loop to 2, it will print "12" if I set the loop to 5, it will print "12345". What I'm working with is a bit more complicated than that, but it all hinges on being able to reference the built-in loop not the FOR loop. Still, your answer will work for my purposes, I'll just have to edit line 2 each time. Thanks!
|
|
|
Post by zeak on Nov 20, 2019 21:56:19 GMT
1 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::0 2 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER1%::10 3 | FOR | I | = | %INTEGER% TO %INTEGER1% | NEXT 4 | RUN ACTION | SELECT WINDOW BY NAME | Untitled - Notepad 5 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER%::+1 6 | X | X | 100 | Keypress %INTEGER% 7 | FOR | NEXT
This should print it out as you require.
|
|