Script example please
Moderators: Dorian (MJT support), JRL
Script example please
I am new to Macro Scheduler but it seems like it may be able to do what im looking for. I have been looking for an example script that does the things im wanting but have been unable to find an example. I was hoping someone could provide me with a script so that I could see exaclty how this could be done and repeat it for different applications.
In laymans terms i was wanting macro scheduler to check a pixel color at a about 5 different locations and if the color matched the certain color im looking for then i want it to send a mouse click. I have gathered the colors at the various pixels and will write a script to show you what i need.
They need to be clicking in a certain window though so I dont know if thats important.
//BEGIN
send mouse click to 121,633
wait 1 second
//COLOR CHECKS
if color at pixel 51,575 = 602443 then
send mouse click to 133,863
if color at pixel 51,575 = 3092822 then
send mouse click to 176,863
if color at pixel 51,575 = 2513786 then
send mouse click to 95,862
if color at pixel 51,575 = 2105891 then
check pixel color at 309,232 and if it does NOT = 0 then
repeat //COLOR CHECKS
but if the color at 309,232 = 0 then
send mouse click to 304,138
wait 1 second
send mouse click to 121,633
and repeat this entire macro starting with //BEGIN
Im sorry this is so crappy. its the best i can do until im able to see an example.
I appreciate any assistance on this script
Thanks
Phil
if you need to email this instead of posting it please send to
[email protected]
In laymans terms i was wanting macro scheduler to check a pixel color at a about 5 different locations and if the color matched the certain color im looking for then i want it to send a mouse click. I have gathered the colors at the various pixels and will write a script to show you what i need.
They need to be clicking in a certain window though so I dont know if thats important.
//BEGIN
send mouse click to 121,633
wait 1 second
//COLOR CHECKS
if color at pixel 51,575 = 602443 then
send mouse click to 133,863
if color at pixel 51,575 = 3092822 then
send mouse click to 176,863
if color at pixel 51,575 = 2513786 then
send mouse click to 95,862
if color at pixel 51,575 = 2105891 then
check pixel color at 309,232 and if it does NOT = 0 then
repeat //COLOR CHECKS
but if the color at 309,232 = 0 then
send mouse click to 304,138
wait 1 second
send mouse click to 121,633
and repeat this entire macro starting with //BEGIN
Im sorry this is so crappy. its the best i can do until im able to see an example.
I appreciate any assistance on this script
Thanks
Phil
if you need to email this instead of posting it please send to
[email protected]
Well you're 90% there. You just needed the syntax. You'll find explanations of all the commands and functions in the help file and sample scripts on our web site. Here's your script coded up:
Label>Begin
MouseMove>121,633
LClick
Wait>1
Label>ColorChecks
GetPixelColor>51,575,c
If>c=602443
MouseMove>133,863
LClick
Endif
GetPixelColor>51,575,c
If>c=3092822
MouseMove>176,863
LClick
Endif
GetPixelColor>51,575,c
If>c=2513786
MouseMove>95,862
LClick
Endif
GetPixelColor>51,575
If>c=2105891
GetPixelColor>309,232,c
If>c0
Goto>ColorChecks
Else
MouseMove>304,138
LClick
Wait>1
MouseMove>121,633
LClick
Goto>Begin
Endif
Endif
Label>Begin
MouseMove>121,633
LClick
Wait>1
Label>ColorChecks
GetPixelColor>51,575,c
If>c=602443
MouseMove>133,863
LClick
Endif
GetPixelColor>51,575,c
If>c=3092822
MouseMove>176,863
LClick
Endif
GetPixelColor>51,575,c
If>c=2513786
MouseMove>95,862
LClick
Endif
GetPixelColor>51,575
If>c=2105891
GetPixelColor>309,232,c
If>c0
Goto>ColorChecks
Else
MouseMove>304,138
LClick
Wait>1
MouseMove>121,633
LClick
Goto>Begin
Endif
Endif
MJT Net Support
[email protected]
[email protected]
wow that was quick
I totally see what is happening in this script now and should have no problem implementing, editing, or adding to this.
Big thanks!
Phil
now ill have to test her out and go from there.
Big thanks!
Phil
now ill have to test her out and go from there.
It seems to send the first mouse click and I added a second mouseclick and it works too, but once it gets to the color checks it seems to not check colors and the macro doesnt repeat. Does Macro Scheduler have to be always on top or is it another issue causeing this?
with if then statements for example
Label>ColorChecks
GetPixelColor>51,575,c
If>c=602443
MouseMove>133,863
LClick
Endif
if the color at 51,575 does not egual 602443 will this statement simple move to the next color check or should I add
Label>ColorChecks
GetPixelColor>51,575,c
If>c=602443
MouseMove>133,863
LClick
else
endif
with if then statements for example
Label>ColorChecks
GetPixelColor>51,575,c
If>c=602443
MouseMove>133,863
LClick
Endif
if the color at 51,575 does not egual 602443 will this statement simple move to the next color check or should I add
Label>ColorChecks
GetPixelColor>51,575,c
If>c=602443
MouseMove>133,863
LClick
else
endif
Correct. I did it that way because that is what you asked for.if the color at 51,575 does not egual 602443 will this statement simple move to the next color check or should I add
If none of the color checks ever resolve true the script will simply end. Maybe you want to add the following line to the end of the script (last line):
Goto>ColorCheck
Then it will repeat even if all the checks resolve false.
In the following example 'do this' ONLY happens if 'something is true' but then the script will continue.
If>something is true
do this
endif
You can also do this:
If>something is true
do this
else
do another
endif
Here we 'do this' if 'something is true' but if 'something is NOT true' we 'do another'.
MJT Net Support
[email protected]
[email protected]
FOUND IT!
This is what you had written originally
GetPixelColor>51,575
If>c=2105891
GetPixelColor>309,232,c
If>c0
Goto>ColorChecks
Else
MouseMove>304,138
LClick
Wait>1
MouseMove>121,633
LClick
Goto>Begin
Endif
Endif
But i wondered why it was failing at the color checks and i added something to what you had written indicated in bold.
GetPixelColor>51,575,c
If>c=2105891
GetPixelColor>309,232,c
If>c0
Goto>ColorChecks
Else
MouseMove>304,138
LClick
Wait>1
MouseMove>121,633
LClick
Goto>Begin
Endif
Endif
Goto>ColorChecks
It runs like a charm...ill be buying this software afterall
great script program
Thank you for you assistance
I'm having trouble stopping the macro using the CTRL-B though
This is what you had written originally
GetPixelColor>51,575
If>c=2105891
GetPixelColor>309,232,c
If>c0
Goto>ColorChecks
Else
MouseMove>304,138
LClick
Wait>1
MouseMove>121,633
LClick
Goto>Begin
Endif
Endif
But i wondered why it was failing at the color checks and i added something to what you had written indicated in bold.
GetPixelColor>51,575,c
If>c=2105891
GetPixelColor>309,232,c
If>c0
Goto>ColorChecks
Else
MouseMove>304,138
LClick
Wait>1
MouseMove>121,633
LClick
Goto>Begin
Endif
Endif
Goto>ColorChecks
It runs like a charm...ill be buying this software afterall
great script program
Thank you for you assistance
I'm having trouble stopping the macro using the CTRL-B though
Hi,
Instead try SHIFT-ESC or whatever you have it set to in Tools/Options. This is a system wide hotkey for stopping any script anywhere. This should work.
Oops, well spotted.GetPixelColor>51,575,c
CTRL-B is a short cut key on the main Macro Scheduler window (short cut to the break menu item) so will only work when it has the focus. The macro is in a tight loop so this could be tricky.I'm having trouble stopping the macro using the CTRL-B though
Instead try SHIFT-ESC or whatever you have it set to in Tools/Options. This is a system wide hotkey for stopping any script anywhere. This should work.
MJT Net Support
[email protected]
[email protected]
One more question please. I'm trying to add a random event.
GetPixelColor>51,575,c
If>c=2105891
GetPixelColor>309,232,c
If>c0
generate a random number and if random number between 1-3=3
Mousemove>133,863
Lclick
Else
Goto>ColorChecks
Else
MouseMove>304,138
LClick
Wait>1
MouseMove>121,633
LClick
Goto>Begin
Endif
Endif
Goto>ColorChecks
is it possible to generate a random number between 1-3 and if that number is 3 send event?
GetPixelColor>51,575,c
If>c=2105891
GetPixelColor>309,232,c
If>c0
generate a random number and if random number between 1-3=3
Mousemove>133,863
Lclick
Else
Goto>ColorChecks
Else
MouseMove>304,138
LClick
Wait>1
MouseMove>121,633
LClick
Goto>Begin
Endif
Endif
Goto>ColorChecks
is it possible to generate a random number between 1-3 and if that number is 3 send event?