I want to do with the script chain condition, but does not work. It is only the first part of the cycle. Here here illustrates what it is. Help me
Label>c
IfWindowOpen>Notepad*,a
IfWindowOpen>Document - WordPad*,b
Label>a
WaitWindowOpen>Notepad*
WindowAction>1,Notepad*
Goto>c
Label>b
WaitWindowOpen>Document - WordPad*
WindowAction>1,Document - WordPad*
Goto>c
help for chain script
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Using labels is messy - your code will always progress through the first label, so if you use labels you need more Gotos to avoid it. Much nicer to use subroutines:
And you don't need WaitWindowOpen. If IfWindowOpen returns true then the window must be open so you don't need to wait for it to open.
However, you could avoid duplication (all your subs do the same thing - the only thing that changes is the window title) like this:
Just add more GoSub calls for the windows you want to add to the "chain".
Code: Select all
Label>main_loop
IfWindowOpen>Notepad*,a
IfWindowOpen>Document - WordPad*,b
Goto>main_loop
SRT>a
WindowAction>1,Notepad*
End>a
SRT>b
WindowAction>1,Document - WordPad*
End>b
However, you could avoid duplication (all your subs do the same thing - the only thing that changes is the window title) like this:
Code: Select all
Label>main_loop
GoSub>maxWin,Notepad*
GoSub>maxWin,Document - WordPad*
Goto>main_loop
SRT>maxWin
IfWindowOpen>%maxWin_Var_1%
WindowAction>1,%maxWin_Var_1%
Endif
End>maxWin
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?
Study the sequence of events this code performs. It will only ever act on Notepad unless you have Wordpad open and Notepad closed when you start the script.
What version of Macro Scheduler do you have? If you have OnEvent>Window_Open available to you try using that function instead of trying to create logic using labels.
Its possible to do what you're asking with labels but it will require a lot more coding. If you don't have OnEvent> at least use subroutines rather than labels.
On another subject, I realize that your posted code is just a sample, but in general, you will save yourself trouble in the future if you DO NOT use single characters to name anything in Macro Scheduler. Label>a would be better as label>a1 and even better as label>NotePadIsOpen
What version of Macro Scheduler do you have? If you have OnEvent>Window_Open available to you try using that function instead of trying to create logic using labels.
Its possible to do what you're asking with labels but it will require a lot more coding. If you don't have OnEvent> at least use subroutines rather than labels.
On another subject, I realize that your posted code is just a sample, but in general, you will save yourself trouble in the future if you DO NOT use single characters to name anything in Macro Scheduler. Label>a would be better as label>a1 and even better as label>NotePadIsOpen