|
Post by Johnc on Jun 4, 2018 13:34:48 GMT
How to copy the clipboard content into a string variable permanently?
I would think a simple STRING definition would do but it wasn't that simple!
for example:
8 | RUN ACTION | | | | DEFINE STRING VARIABLE | %STRING1%::%CLIPBOARD% 9 | RUN ACTION | | | | MESSAGE PROMPT | %STRING1%::clip
Worked immediately after this macro line. However, as the macro goes on to subsequent lines that I put something else into the clipboard, the %STRING1% variable changed into the clipboard content without the %STRING1% variable being referenced or re-defined in subsequent lines!
Is this normal or am I missing something again? I need to permanently store different clipboard results into different variables. How can it be done?
Thanks once again!
|
|
|
Post by Johnc on Jun 4, 2018 14:07:51 GMT
This is strange... An INTEGER variable seems to hold the value that it copied from the clipboard permanently:
8 | RUN ACTION | | | | DEFINE INTEGER VARIABLE | %INTEGER1%::%CLIPBOARD% 9 | RUN ACTION | | | | MESSAGE PROMPT | %INTEGER1%::clip
Any enlightenment? Thank you!
|
|
|
Post by Steve on Jun 5, 2018 9:19:56 GMT
Hi John, 1 | RUN ACTION | | | | DEFINE STRING VARIABLE | %STRING%::%clipboard% 2 | RUN ACTION | | | | MESSAGE PROMPT | %string%::clip
Defining the %string% as %clipboard% sets the variable permanently to %clipboard%. Note the screenshot above.
The %integer1% variable in your example will hold the value, if %clipboard% is a valid integer, because it is forced at run time from a string to an integer for the variable definition. Something like integer1 = cint(%clipboard%). When clipboard is not a number the conversion will not happen. I've given this one a really quick look, and at this stage all i can think to make this work is outputting the value to a .mmmacro file and running it at run time on a separate MMM process. This example needs a bit of work, but something like will get us in the right direction: 1 | RUN ACTION | | | | DEFINE STRING VARIABLE | %STRING%::%string% 2 | RUN ACTION | | | | RUN VIA CMD /C | echo 1 ^| RUN ACTION ^| ^| ^| ^| DEFINE STRING VARIABLE ^| %STRING%::%clipboard%>c:\temp\mmmout.mmmacro 3 | IF | FILE | C:\temp\mmmout.mmmacro | EXIST | CONTINUE 4 | RUN ACTION | | | | RUN VIA CMD /C | C:\temp\MiniMouseMacro.exe /e /d:1000 c:\temp\mmmout.mmmacro 5 | RUN ACTION | | | | WAIT SECONDS | 5 6 | RUN ACTION | | | | MESSAGE PROMPT | Value: %string%::clip
I need to do some more work on IO control with stdin and stdout.
|
|
|
Post by Johnc on Jun 5, 2018 15:15:42 GMT
Thank you so much Steve for the explanation. Perhaps I try to limit myself to Integer variables for now and only use one string variable ie clipboard to store 1 string and "parse" the string using multiple "backspace"s LOL!
Thanks for demonstrating how a separate MMM process can be run and it may become handy in the future.
Despite some small limitations, I still think MMM is one of the best and most powerful MACRO tool out there! I am still scratching the surface here and would love to explore and learn more about the NetWork tool as I don't know anything about Networking. Wow, there is a Network packet monitor too! It is working but I have no idea what packet strings/text to look for etc.
Thanks Steve once again for making this wonderful tool available to the public! Highly appreciated!
|
|