I am trying to write a wrapper subroutine that will work in a compiled script. Something like this:
SRT>DoThis
TimeStamp>%DoThis_Var_1%,%DoThis_Var_2%,...etc
MouseMove>%DoThis_Var_1%,%DoThis_Var_2%
Wait>%DoThis_Var_3%
%DoThis_Var_4%
Press %DoThis_Var_5%
Send Character/Text>%DoThis_Var_6%
Release %DoThis_Var_5%
End>Dothis
gosub>Dothis,X,Y,1,LClick,LShift,Hello Marcus
All the commands in the subroutine work except these:
%DoThis_Var_4%
Press %DoThis_Var_5%
(However, these commands do appear in the logfile)
I would rather my subroutine did not need a series of if statements to check for all the possible mouse , press or release actions.
I will have the same problem with any command whose syntax is not of the form "command>arg1,arg2,arg3..."
Is there a recommended way to do this?
Is a enhancement required?
Thanks,
Gale
Is there "best" way to create a wrapper for press
Moderators: JRL, Dorian (MJT support)
How about:
Code: Select all
SRT>DoThis
WriteLn>%temp_dir%dothis.scp,wres,TimeStamp>%DoThis_Var_1%,%DoThis_Var_2%,...etc
WriteLn>%temp_dir%dothis.scp,wres,MouseMove>%DoThis_Var_1%,%DoThis_Var_2%
WriteLn>%temp_dir%dothis.scp,wres,Wait>%DoThis_Var_3%
WriteLn>%temp_dir%dothis.scp,wres,%DoThis_Var_4%
WriteLn>%temp_dir%dothis.scp,wres,Press %DoThis_Var_5%
WriteLn>%temp_dir%dothis.scp,wres,Send Character/Text>%DoThis_Var_6%
WriteLn>%temp_dir%dothis.scp,wres,Release %DoThis_Var_5%
Macro>%temp_dir%dothis.scp
Deletefile>%temp_dir%dothis.scp
End>Dothis
gosub>Dothis,X,Y,1,LClick,LShift,Hello Marcus
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Is there "best" way to create a wrapper for pr
Version 11 will allow you to do that. Until then the Press... commands are commands in and of themselves. With v11 you can optionally make Press work as a function taking the key as a parameter.gdyvig wrote: All the commands in the subroutine work except these:
%DoThis_Var_4%
Press %DoThis_Var_5%
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Mouse commands too?
Very good!
Are you planning to consolidate the mouse click commands into a function for a future release?
JRL's method of creating a macro on the fly works provided you are running the compiled macro on a machine with MS installed, similar to my "Evaluate Command" enhancement suggestion a few weeks ago.
Are you planning to consolidate the mouse click commands into a function for a future release?
JRL's method of creating a macro on the fly works provided you are running the compiled macro on a machine with MS installed, similar to my "Evaluate Command" enhancement suggestion a few weeks ago.
From my happy button post.JRL's method of creating a macro on the fly works provided you are running the compiled macro on a machine with MS installed,
Here is the above rewritten to run as both a script and/or a compiled script. (I did not test this so I could have left something out but it "looks" right.)For anyone who's interested there's a couple of interesting tidbits in here... a workaround for a non-modal Macro> function. (Will work as a script or compiled.)

EDIT:Fixed the posted script (below) and tested it to be sure it works.
Code: Select all
//Determine if the process is a script or an exe
//Set mProcessor variable accordingly
StringReplace>%COMMAND_LINE%,",,COMMAND_LINE
VBSTART
VBEND
VBEval>Lcase("%COMMAND_LINE%"),COMMAND_LINE
Position>.exe,%COMMAND_LINE%,1,exe_loc
Add>exe_loc,4
Midstr>%COMMAND_LINE%,1,%exe_loc%,COMMAND_LINE
Separate>%COMMAND_LINE%,\,prossvar
Let>value=prossvar_%prossvar_count%
Separate>value,.,value
If>%value_1%=msched
Let>mProcessor=%COMMAND_LINE%%SPACE%
Else
Let>mProcessor=%COMMAND_LINE% /Script=
EndIf
//If the variable "Script" has a value, then this executable has been
//invoked by itself as a script processing agent. Run the script then exit.
Ass>Script,RunScript
If>RunScript=TRUE
Macro>Script
Goto>EOF
EndIF
SRT>DoThis
WriteLn>%temp_dir%dothis.scp,wres,TimeStamp>%DoThis_Var_1%,%DoThis_Var_2%,...etc
WriteLn>%temp_dir%dothis.scp,wres,MouseMove>%DoThis_Var_1%,%DoThis_Var_2%
WriteLn>%temp_dir%dothis.scp,wres,Wait>%DoThis_Var_3%
WriteLn>%temp_dir%dothis.scp,wres,%DoThis_Var_4%
WriteLn>%temp_dir%dothis.scp,wres,Press %DoThis_Var_5%
WriteLn>%temp_dir%dothis.scp,wres,Send Character/Text>%DoThis_Var_6%
WriteLn>%temp_dir%dothis.scp,wres,Release %DoThis_Var_5%
//Run msched.exe %temp_dir%dothis.scp or thisexe.exe %temp_dir%dothis.scp
Run>%mProcessor%%temp_dir%dothis.scp
Deletefile>%temp_dir%dothis.scp
End>DoThis
gosub>DoThis,200,200,1,LClick,LShift,Hello Marcus
Label>EOF