Help with script/Image recognition issue

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
pk24
Newbie
Posts: 3
Joined: Sun Feb 03, 2008 4:15 pm

Help with script/Image recognition issue

Post by pk24 » Sun Feb 03, 2008 4:28 pm

Hi Im trying out your software to see if its possable to do what Im after

Ive got basic knowledge of programming all be it a bit rusty as not being used for 10+ yrs

what Im after is a script that will pick 7 specific cards for a online battle card game even though the card positions can change , so hence the need for image recognition

Ive manged to get it to choose the first card and drag it to the selection window then told page to move down ( press down key 34 times )

then do a fresh screengrab then look for next card via image recognition

this is where Im hitting a brick wall as the screengrab seems same as first one ( before the screen is moved down even though it is being moved down )

anyways heres a copy of my script any ideas tips would be appreciated

GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,c:\macrosched\cardsscreen1.bmp
FindImagePos>C:\macrosched\Flob Goblin.bmp,c:\macrosched\cardsscreen1.bmp,20,1,Xpos,Ypos,Flob1
If>Flob1>0
MouseMove>Xpos_0,Ypos_0
LDown
MouseMove>900,500
LUp
Endif
Press Down * 34
GetScreenRes>sX2,sY2
ScreenCapture>0,0,sX2,sY2,c:\macrosched\cardsscreen2.bmp
FindImagePos>C:\macrosched\rambogie.bmp,C:\macrosched\cardsscreen2.bmp,20,1,Xpos2,Ypos2,Ram1
If>Ram1>0
MouseMove>Xpos2_0,Ypos2_0
LDown
MouseMove>900,500
LUp
Endif

I also want somehow the script to if it dont find the image move screen down and look for it again before looking for the second card but wanted the basics to work first

cheers for any help

Pk24

pk24
Newbie
Posts: 3
Joined: Sun Feb 03, 2008 4:15 pm

Post by pk24 » Mon Feb 04, 2008 1:07 am

ok been meddling with this for last few hours , seems I needed a wait command in before it did the next screengrab even though the screen moved down

anyways Ive got it to look for the 7 cards now and select thenm and click submit

heres my first macro :)

ScreenCapture>0,0,1000,1000,c:\macrosched\cardsscreen1.bmp
FindImagePos>C:\macrosched\beta.bmp,C:\macrosched\cardsscreen1.bmp,20,1,Xp,Yp,beta1
If>beta1>0
LClick
Endif
Label>Look4flob
FindImagePos>C:\macrosched\flob.bmp,c:\macrosched\cardsscreen1.bmp,20,1,Xpos,Ypos,flob1
If>flob1>0
MouseMove>Xpos_0,Ypos_0
LDown
MouseMove>800,500
LUp
Wait>2
Label>Look4Ram
ScreenCapture>0,0,1000,1000,c:\macrosched\cardsscreen2.bmp
FindImagePos>C:\macrosched\ram.bmp,C:\macrosched\cardsscreen2.bmp,20,1,Xpos2,Ypos2,ram1
If>ram1>0
MouseMove>Xpos2_0,Ypos2_0
LDown
MouseMove>800,500
LUp
Wait>2
Label>Look4Slip
ScreenCapture>0,0,1000,1000,c:\macrosched\cardsscreen3.bmp
FindImagePos>C:\macrosched\slip.bmp,C:\macrosched\cardsscreen3.bmp,20,1,Xpos2,Ypos2,slip1
If>slip1>0
MouseMove>Xpos2_0,Ypos2_0
LDown
MouseMove>800,500
LUp
Label>Look4Gooey
ScreenCapture>0,0,1000,1000,c:\macrosched\cardsscreen4.bmp
FindImagePos>C:\macrosched\gooey.bmp,C:\macrosched\cardsscreen4.bmp,20,1,Xpos2,Ypos2,gooey1
If>gooey1>0
MouseMove>Xpos2_0,Ypos2_0
LDown
MouseMove>800,500
LUp
Label>Look4Gobzilla
ScreenCapture>0,0,1000,1000,c:\macrosched\cardsscreen5.bmp
FindImagePos>C:\macrosched\gobzilla.bmp,C:\macrosched\cardsscreen5.bmp,20,1,Xpos2,Ypos2,gobzilla1
If>gobzilla1>0
MouseMove>Xpos2_0,Ypos2_0
LDown
MouseMove>800,500
LUp
Label>Look4Billy
ScreenCapture>0,0,1000,1000,c:\macrosched\cardsscreen6.bmp
FindImagePos>C:\macrosched\billybob.bmp,C:\macrosched\cardsscreen6.bmp,20,1,Xpos2,Ypos2,billybob1
If>billybob1>0
MouseMove>Xpos2_0,Ypos2_0
LDown
MouseMove>800,500
LUp
Label>Look4Snoz
ScreenCapture>0,0,1000,1000,c:\macrosched\cardsscreen7.bmp
FindImagePos>C:\macrosched\snoz.bmp,C:\macrosched\cardsscreen7.bmp,20,1,Xpos2,Ypos2,snoz1
If>snoz1>0
MouseMove>Xpos2_0,Ypos2_0
LDown
MouseMove>800,500
LUp
Label>Look4Submit
ScreenCapture>0,0,1000,1000,c:\macrosched\cardsscreen8.bmp
FindImagePos>C:\macrosched\submit.bmp,C:\macrosched\cardsscreen8.bmp,20,1,Xpos2,Ypos2,submit1
If>submit1>0
MouseMove>Xpos2_0,Ypos2_0
LClick
ELSE
Wait>2
Press Page Down
Wait>2
Goto>Look4Submit
Endif
ELSE
Wait>2
Press Page Down
Wait>2
Goto>Look4Snoz
Endif
ELSE
Wait>2
Press Page Down
Wait>2
Goto>Look4Billy
Endif
ELSE
Wait>2
Press Page Down
Wait>2
Goto>Look4Gobzilla
Endif
ELSE
Wait>2
Press Page Down
Wait>2
Goto>Look4Gooey
Endif
ELSE
Wait>2
Press Page Down
Wait>2
Goto>Look4Slip
Endif
ELSE
Wait>2
Press Page Down
Wait>2
Goto>Look4Ram
Endif
ELSE
Wait>2
Press Page Down
Wait>2
Goto>Look4Flob
Endif

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts