Hi,
I need this code: "If clipboard contains "aaaaaa", then stop, else continus to execute the macro.
I'm not able to make this . ¿Does someone help me?
¡Thanks!
If clipboard contains something, then...
Moderators: Dorian (MJT support), JRL
More information would be helpful. What are you trying to do?
Are you looking for a way to check the clipboard during a loop in your script? Or does this need to work the moment the test string enters the clipboard? If the former, just place the following in your script in an appropriate spot.
If the latter, it gets a little more complicated. there are no event handlers in Macro Scheduler to directly detect clipboard contents and then act on the contents. That said you could do just that by being a little creative.
You could write the above code lines to a secondary script and insert above the Exit>0 line a Writeln> that creates a file to be detected by the "file_exists". Something like.
so what do you need?
Here's a working sample:
Are you looking for a way to check the clipboard during a loop in your script? Or does this need to work the moment the test string enters the clipboard? If the former, just place the following in your script in an appropriate spot.
Code: Select all
GetClipBoard>data
If>data=aaaaaa
Exit>0
EndIf
You could write the above code lines to a secondary script and insert above the Exit>0 line a Writeln> that creates a file to be detected by the "file_exists". Something like.
Code: Select all
OnEvent>file_exists,%temp_dir%scratchFile.tmp,0,CloseScript
SRT>CloseScript
DeleteFile>%temp_dir%scratchFile.tmp
DeleteFile>%temp_dir%scratchFile.scp
Exit>0
END>CloseScript
WriteLn>%temp_dir%scratchFile.scp,wres,Label>Start
WriteLn>%temp_dir%scratchFile.scp,wres,GetClipBoard>data
WriteLn>%temp_dir%scratchFile.scp,wres,If>data=aaaaaa
WriteLn>%temp_dir%scratchFile.scp,wres, WriteLn>%temp_dir%scratchFile.tmp,Wres,1
WriteLn>%temp_dir%scratchFile.scp,wres, Exit>0
WriteLn>%temp_dir%scratchFile.scp,wres,EndIf
WriteLn>%temp_dir%scratchFile.scp,wres,Wait>0.01
WriteLn>%temp_dir%scratchFile.scp,wres,goto>Start
ExecuteFile>%temp_dir%scratchFile.scp
////the rest of your code
Here's a working sample:
Code: Select all
OnEvent>file_exists,%temp_dir%scratchFile.tmp,0,CloseScript
SRT>CloseScript
DeleteFile>%temp_dir%scratchFile.tmp
DeleteFile>%temp_dir%scratchFile.scp
Exit>0
END>CloseScript
WriteLn>%temp_dir%scratchFile.scp,wres,Label>Start
WriteLn>%temp_dir%scratchFile.scp,wres,GetClipBoard>data
WriteLn>%temp_dir%scratchFile.scp,wres,If>data=aaaaaa
WriteLn>%temp_dir%scratchFile.scp,wres, WriteLn>%temp_dir%scratchFile.tmp,Wres,1
WriteLn>%temp_dir%scratchFile.scp,wres, Exit>0
WriteLn>%temp_dir%scratchFile.scp,wres,EndIf
WriteLn>%temp_dir%scratchFile.scp,wres,Wait>0.01
WriteLn>%temp_dir%scratchFile.scp,wres,goto>Start
ExecuteFile>%temp_dir%scratchFile.scp
Dialog>Dialog1
Caption=Counting
Width=445
Height=250
Top=148
Left=27
Label=msLabel1,168,112
EndDialog>Dialog1
show>Dialog1
Let>kk=0
Label>Loop
Add>kk,1
Let>dialog1.mslabel1=%kk%
ResetDialogAction>dialog1
Wait>0.01
goto>Loop
Macro stops when clipboard contens something
Hi JRL,
I have Doc1.doc with 150 lines. The macro must cut the first line, to jumps to Doc2.doc, search this line and delete it. Then, jumps to Doc1.doc and repeats.
I have make the macro and it works well but I will like that the macro stops al the end of Doc1.doc. So, if I add at the end of Doc1.doc a line like "aaaaaa", the macro stops when Macro Scheduler detects that clipboard contents is "aaaaaa".
Thanks for your help
I have Doc1.doc with 150 lines. The macro must cut the first line, to jumps to Doc2.doc, search this line and delete it. Then, jumps to Doc1.doc and repeats.
I have make the macro and it works well but I will like that the macro stops al the end of Doc1.doc. So, if I add at the end of Doc1.doc a line like "aaaaaa", the macro stops when Macro Scheduler detects that clipboard contents is "aaaaaa".
Thanks for your help
¡¡¡Thanks, JRL!!!
Code: Select all
GetClipBoard>data
If>data=aaaaaa
Exit>0
EndIf
Hi JRL,
This simple code is perfect for my macro. Thanks!!!