Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
idiot
- Macro Veteran
- Posts: 152
- Joined: Thu Mar 01, 2007 9:21 am
Post
by idiot » Tue Dec 18, 2007 3:38 am
im trying to use this findcolor dll script with onevent basically i want to have it search for the colors and when one of the colors is detected have it use onevent to go to the specified subroutine really confused on how to do this please help i was thinking it would be somthing like this but im not sure how to use the onevent for something like this
Code: Select all
let>color2=88888
let>color=99999
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
LibFunc>fcLib,FindColor,r,color,124,168,640,500,xres,yres
LibFunc>fcLib,FindColor,r,color2,124,168,640,500,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
-
Rain
- Automation Wizard
- Posts: 550
- Joined: Tue Aug 09, 2005 5:02 pm
-
Contact:
Post
by Rain » Tue Dec 18, 2007 5:16 pm
Which onevent do you want to use? There are 8 different event types in version 9.
This script will use the findcolor DLL to search for 2 colors in the specified area and go to a sub routine when the colors are located.
Code: Select all
let>color1=88888
let>color2=99999
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
label>FindColorLoop
Wait>1
let>x=124
let>y=168
let>w=640
let>h=500
LibFunc>fcLib,FindColor,r1,color1,x,y,w,h,xres,yres
If>r1=1
Let>x=r1_6
Let>y=r1_7
MouseMove>x,y
GoSub>DoSomething
endif
Wait>1
let>x=124
let>y=168
let>w=640
let>h=500
LibFunc>fcLib,FindColor,r2,color2,x,y,w,h,xres,yres
If>r2=1
Let>x=r2_6
Let>y=r2_7
MouseMove>x,y
GoSub>DoSomething
endif
GoTo>FindColorLoop
SRT>DoSomething
//Do something
END>DoSomething
-
Rain
- Automation Wizard
- Posts: 550
- Joined: Tue Aug 09, 2005 5:02 pm
-
Contact:
Post
by Rain » Tue Dec 18, 2007 5:32 pm
Even Shorter
Code: Select all
let>color1=88888
let>color2=99999
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
Label>FindColor
let>K=0
Repeat>K
Wait>1
let>K=K+1
let>x=124
let>y=168
let>w=640
let>h=500
LibFunc>fcLib,FindColor,r,color%K%,x,y,w,h,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
GoSub>DoSomething
endif
Until>K,2
goto>FindColor
SRT>DoSomething
//Do something
END>DoSomething
-
idiot
- Macro Veteran
- Posts: 152
- Joined: Thu Mar 01, 2007 9:21 am
Post
by idiot » Wed Dec 19, 2007 10:14 am
i was wanting it to go to a certain subroutine depending wich color it found
like if it found color 88888 go to one sub and if it found 99999 to go to a different sub so i could constantly have it search for multiple colors in 1 loop and do different things depending on wich color it finds
so was thinking it would be something like this added on to the 1st script
i posted so that way i can shorten many other scripts i have made
onevent>findcolor=color1,sub1
onevent>findcolor=color2,sub2
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
-
Rain
- Automation Wizard
- Posts: 550
- Joined: Tue Aug 09, 2005 5:02 pm
-
Contact:
Post
by Rain » Wed Dec 19, 2007 2:02 pm
Like this?
Code: Select all
let>color1=88888
let>color2=99999
Let>fcLib=%SCRIPT_DIR%\findcolor.dll
Label>FindColor
let>K=0
Repeat>K
Wait>1
let>K=K+1
let>x=124
let>y=168
let>w=640
let>h=500
LibFunc>fcLib,FindColor,r,color%K%,x,y,w,h,xres,yres
If>r=1
Let>x=r_6
Let>y=r_7
MouseMove>x,y
GoSub>DoSomething%K%
endif
Until>K,2
goto>FindColor
SRT>DoSomething1
//Color 1
//Do something
END>DoSomething1
SRT>DoSomething2
//Color 2
//Do something
END>DoSomething2
-
Rain
- Automation Wizard
- Posts: 550
- Joined: Tue Aug 09, 2005 5:02 pm
-
Contact:
Post
by Rain » Wed Dec 19, 2007 5:33 pm
Below are the on event types documented in the help file. I don't think there is a FIND_COLOR event unless it's not documented. However, you can accomplish the same thing with my last example.
WINDOW_OPEN
WINDOW_NOTOPEN
WINDOW_NEWACTIVE
FILE_EXISTS
FILE_NOTEXISTS
KEY_DOWN
DIALOG_EVENT
DIALOG_CHANGE
-
idiot
- Macro Veteran
- Posts: 152
- Joined: Thu Mar 01, 2007 9:21 am
Post
by idiot » Thu Dec 20, 2007 12:37 am
i dont understand how ths script uses the color1 and color2
to go to the sub depending on wich one its finds can you explain how this works please
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Thu Dec 20, 2007 8:31 am
Read it carefully then step through it with the debugger and you will see.
color1=88888
color2=99999
Look at the Repeat Until loop which repeats k until k = 2
K=1
LibFunc>fcLib,FindColor,r,color%k% ....
color%K% = color1
If Found it goes to DoSomething%k% = DoSomething1
K=2
LibFunc>fcLib,FindColor,r,color%k% ....
color%K% = color2
If Found it goes to DoSomething%k% = DoSomething2
-
idiot
- Macro Veteran
- Posts: 152
- Joined: Thu Mar 01, 2007 9:21 am
Post
by idiot » Fri Dec 21, 2007 5:54 am
thanks a bunch got it figured out now i can make my scripts more managable

if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
-
idiot
- Macro Veteran
- Posts: 152
- Joined: Thu Mar 01, 2007 9:21 am
Post
by idiot » Sat Dec 22, 2007 11:35 pm
sorry brain not working no need to ask what i was going to
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!