|
Post by Johnc on Sept 3, 2018 1:30:33 GMT
Hi Steve,
Spent hours on the following codes but could not figure out what was wrong. I would highly appreciate any help! On the first pass thru, variables contents seemed ok. But when it entered the second loop around, the variable %STRING3% was reset to "NULL" or "" (nothing)!!! I was hoping %STRING3% would retain "USA" for the second loop around. Tested on MMM Pro V6.7.0. and also MMM V6.7.0. Same results. Thanks! PS: actually all variables seemed to have been reset on the second loop around!!
Here is the main macro:
1 | RUN ACTION | | | | SELECT WINDOW BY NAME | WordPad 2 | X | X | 1000 | Keypress Ctrl+ | home 3 | X | X | 100 | Keypress Shift+ | END 4 | X | X | 100 | Keypress Shift+ | LEFT 5 | X | X | 100 | Keypress Ctrl+ | c 6 | X | X | 100 | Keypress DELETE 7 | X | X | 100 | Keypress DELETE 8 | IF | CLIPBOARD | VALUE | TEXT IS | END | STOP 9 | RUN ACTION | | | | MESSAGE PROMPT | %STRING% %STRING3%::out0 10 | FOR | EACH | LINE IN | E:\File_John\F_variable\minimm\CLIPBOARD_IN_NOECHO.mmmacro | RUN 11 | RUN ACTION | | | | MESSAGE PROMPT | %STRING% %STRING3%::out1 12 | IF | STRING VARIABLE | %STRING% | IS | USA | MESSAGE PROMPT | this is usa::outif 13 | IF | STRING VARIABLE | %STRING% | IS | USA | DEFINE STRING VARIABLE | %STRING3%::USA 14 | IF | STRING VARIABLE | %STRING% | IS | CDN | DEFINE STRING VARIABLE | %STRING3%::CDN 15 | RUN ACTION | | | | MESSAGE PROMPT | %STRING% %STRING3%::out2 16 | IF | STRING VARIABLE | %STRING% | IS | USA | GOTO MACRO LINE | 1 17 | IF | STRING VARIABLE | %STRING% | IS | CDN | GOTO MACRO LINE | 1 18 | RUN ACTION | | | | MESSAGE PROMPT | %STRING% %STRING3%::out3
|
|
|
Post by Johnc on Sept 3, 2018 1:42:27 GMT
WordPad contained:
USA John CDN Mary END
|
|
|
Post by Johnc on Sept 3, 2018 1:44:44 GMT
Your ingenious macro to copy %CLIPBOARD% to %STRING% is here as I copied it exactly and it works.
Name is: E:\File_John\F_variable\minimm\CLIPBOARD_IN_NOECHO.mmmacro
1 | RUN ACTION | | | | DEFINE STRING VARIABLE | %STRING%::%STRING% 2 | RUN ACTION | | | | DEFINE STRING VARIABLE | %STRING1%:: | 3 | IF | FILE | E:\File_John\F_variable\minimm\in.mmmacro | EXIST | DELETE FILE | E:\File_John\F_variable\minimm\in.mmmacro 4 | RUN ACTION | | | | OUTPUT TO FILE | E:\File_John\F_variable\minimm\in.mmmacro::APPEND::1%STRING1% RUN ACTION%STRING1% %STRING1% %STRING1% %STRING1% DEFINE STRING VARIABLE%STRING1% 5 | RUN ACTION | | | | OUTPUT TO FILE | E:\File_John\F_variable\minimm\in.mmmacro::APPEND:: %STRING% 6 | RUN ACTION | | | | WAIT SECONDS | 1 7 | RUN ACTION | | | | RUN VIA CMD /C | echo ^:^:%CLIPBOARD%>>E:\File_John\F_variable\minimm\in.mmmacro 8 | RUN ACTION | | | | WAIT SECONDS | 1 9 | FOR | EACH | LINE IN | E:\File_John\F_variable\minimm\in.mmmacro | RUN
|
|
|
Post by Johnc on Sept 3, 2018 3:58:09 GMT
looks like variables were cleared after this condition evaluated true and the GOTO action executed.
16 | IF | STRING VARIABLE | %STRING% | IS | USA | GOTO MACRO LINE | 1
|
|
|
Post by Johnc on Sept 4, 2018 10:16:47 GMT
modified the simple script to the following:
1 | RUN ACTION | | | | MESSAGE PROMPT | %STRING% %STRING3%::out1 2 | RUN ACTION | | | | SELECT WINDOW BY NAME | WordPad 3 | X | X | 1000 | Keypress Ctrl+ | home 4 | X | X | 100 | Keypress Shift+ | END 5 | X | X | 100 | Keypress Shift+ | LEFT 6 | X | X | 100 | Keypress Ctrl+ | c 7 | X | X | 100 | Keypress DELETE 8 | X | X | 100 | Keypress DELETE 9 | IF | CLIPBOARD | VALUE | TEXT IS | END | STOP 10 | FOR | EACH | LINE IN | E:\File_John\F_variable\minimm\CLIPBOARD_IN_NOECHO.mmmacro | RUN 11 | IF | STRING VARIABLE | %STRING% | IS | USA | MESSAGE PROMPT | this is usa::out2 12 | IF | STRING VARIABLE | %STRING% | IS | USA | DEFINE STRING VARIABLE | %STRING3%::USA 13 | IF | STRING VARIABLE | %STRING% | IS | CDN | DEFINE STRING VARIABLE | %STRING3%::CDN 14 | RUN ACTION | | | | MESSAGE PROMPT | %STRING% %STRING3%::out3 15 | RUN ACTION | | | | GOTO MACRO LINE | 1
Worked ok till line 14 as the variables's contents were ok. After the goto on line 5, line 1 no longer shows the correct variable contents! Seemed like line 15 with the goto cleared all variables! It seems a MMM bug to me, or is it? Thanks!
|
|
|
Post by Steve on Sept 5, 2018 7:09:10 GMT
Hi John, I'm mid way through an update that fixes the issue of getting variable data into MMM. The 16 script lines you have written above have pretty much replaced with 1 line of the updated version. I'm probably a couple of weeks off the official release. Do you want to check it out now, I can send you the release prior to the release date? it will fix your issue. The update adds a new feature that monitors a file for variable input. The new action works like this: 2 | RUN ACTION | | | | INPUT FROM FILE | variables::REFRESH::D:\Macro\RX\VARSmany.txt VARSmany.txtINTEGER::1000 INTEGER1::20000 INTEGER2::30000 INTEGER3::40000 INTEGER4::50000 STRING::Ants STRING1::Bee STRING2::Cats STRING3::Dogs STRING4::Eagles The action assigns the values in VARSmany.txt to the variables. Whenever there is a change to VARSmany.txt the macro will automatically update the variables in real time during the running macro. The action can also be used for single variables. The line below assigns the value in VARS.txt to the %integer% variable whilst monitoring the file: 2 | RUN ACTION | | | | INPUT FROM FILE | integer::REFRESH::D:\Macro\RX\VARS.txt VARS.txt1000
The new action is available via the 'add condition' menu.
Let me know if you want to check it out. Regards, Steve.
|
|
|
Post by Johnc on Sept 5, 2018 9:55:57 GMT
Hi Steve, this is so cool! I love to try it. Please see PM. How do u change the VARS.txt file from MMM? Thanks! John
|
|
|
Post by Johnc on Sept 5, 2018 19:51:49 GMT
The MMM Beta V6.7.1.0 worked Steve!! Yay!! The new "INPUT FROM FILE" action worked beautifully in combination with "OUTPUT TO FILE"!! Now I can store a snapshot of %CLIPBOARD% in any string variable. Example shown here is with %STRING%. Now I no longer need to use the submacro "CLIPBOARD_IN_NOECHO.mmmacro". Nice work Steve! Congrat and a million thanks!! * | 10 | FOR | EACH | LINE IN | E:\File_John\F_variable\minimm\CLIPBOARD_IN_NOECHO.mmmacro | RUN 13 | RUN ACTION | | | | OUTPUT TO FILE | E:\File_John\F_variable\minimm\temp.txt::OVERWRITE::%CLIPBOARD% * | 14 | RUN ACTION | | | | WAIT SECONDS | 1 15 | RUN ACTION | | | | INPUT FROM FILE | STRING::NO_REFRESH::E:\File_John\F_variable\minimm\temp.txt
Note the WAIT 1 SECOND line is not even required! Great job Steve!!
|
|
|
Post by Steve on Sept 6, 2018 23:16:59 GMT
The 6.7.X can assign %clipboard% directly to %string% now:
2 | RUN ACTION | | | | DEFINE STRING VARIABLE | %STRING%::%clipboard% So you might not need the output and input file IO anyway.
|
|
|
Post by Johnc on Sept 7, 2018 1:38:32 GMT
Wow Steve! Such a good news! Yes, just tested the direct assignment of %clipboard% to %STRING% via a big Macro on 6.7.X! It is working!! Yay!! %STRING% is now fully independent of %CLIPBOARD%!! How silly I was to use 2 lines when 1 would do! Another great accomplishment Steve! Congrat!! Thanks so much for the hard work!!!
|
|