Help with Findimagepos
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 6
- Joined: Wed Dec 17, 2008 2:11 am
Help with Findimagepos
hello iam new to your scripting program but iam not new to programing
i have made a script to log onto a game and sign in and so on then i came to the part to make the macro move me from one place to another so i dident have to sit their and do it my self all the time. i thort i would do it once programing the macro then its all sorted but here is the code iam useing.
wait>10
GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\stationundock.bmp
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\undock_station.bmp,C:\stationundock.bmp,20,1,Xpos,Ypos,imgs3
If>imgs3>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
wait>20
press CTRL
send>
release CTRL
wait>10
GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\selectwarptozid.bmp
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\nextstargate.bmp,C:\selectwarptozid.bmp,20,1,Xpos,Ypos,imgs4
If>imgs4>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
as far as i kno that should work, everything else is fine just when i get to this bit it decides to flsh the cursor then do nothing i was woundering if the icon iam trying to click is to small for the image reccognition system
here is the icon iam trying to click
http://img165.imageshack.us/img165/5525 ... atejb2.jpg
As you can see the icon is small but i need the macro to beable to see this otherwise the macro is useless
Thankyou in Advance Beattie282
i have made a script to log onto a game and sign in and so on then i came to the part to make the macro move me from one place to another so i dident have to sit their and do it my self all the time. i thort i would do it once programing the macro then its all sorted but here is the code iam useing.
wait>10
GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\stationundock.bmp
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\undock_station.bmp,C:\stationundock.bmp,20,1,Xpos,Ypos,imgs3
If>imgs3>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
wait>20
press CTRL
send>
release CTRL
wait>10
GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\selectwarptozid.bmp
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\nextstargate.bmp,C:\selectwarptozid.bmp,20,1,Xpos,Ypos,imgs4
If>imgs4>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
as far as i kno that should work, everything else is fine just when i get to this bit it decides to flsh the cursor then do nothing i was woundering if the icon iam trying to click is to small for the image reccognition system
here is the icon iam trying to click
http://img165.imageshack.us/img165/5525 ... atejb2.jpg
As you can see the icon is small but i need the macro to beable to see this otherwise the macro is useless
Thankyou in Advance Beattie282
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Hope this helps
First I noticed where you wrote
press CTRL
send>
release CTRL
There is nothing sent.
Second I noticed Imgs3, Imgs4.
I replaced them with a simple Imgs>0, If 0 images are found then there is no longer anything for the script to do.
Imgs3 & Imgs4 mean nothing.
Third, I check to see if i could get MS to find the image and it worked great, so there is no need to worry about it being to small.
Forth, I noticed in your post the image address was http://img165.imageshack.us/img165/5525 ... atejb2.jpg
Are you using this nextstargatejb2.jpg or is it a bmp.
Make sure you are saving them as bmp as I could not get it to run untill I saved all images as bmp and made sure my script also had them as bmp
Try the script below and check your img types
Best of luck and let me now if you have success.
press CTRL
send>
release CTRL
There is nothing sent.
Second I noticed Imgs3, Imgs4.
I replaced them with a simple Imgs>0, If 0 images are found then there is no longer anything for the script to do.
Imgs3 & Imgs4 mean nothing.
Third, I check to see if i could get MS to find the image and it worked great, so there is no need to worry about it being to small.
Forth, I noticed in your post the image address was http://img165.imageshack.us/img165/5525 ... atejb2.jpg
Are you using this nextstargatejb2.jpg or is it a bmp.
Make sure you are saving them as bmp as I could not get it to run untill I saved all images as bmp and made sure my script also had them as bmp
Try the script below and check your img types
Code: Select all
wait>10
GetScreenRes>X,Y
wait>02
ScreenCapture>0,0,X,Y,C:\stationundock.bmp
label>loop
wait>1
IfFileExists>C:\stationundock.bmp,FirstFileFound
goto>loop
Label>FirstFileFound
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\undock_station.bmp,C:\stationundock.bmp,0,1,X,Y,NumFound
If>NumFound>0
MouseMove>X_0,Y_0
Lclick
Endif
wait>20
press CTRL
send>
release CTRL
wait>10
GetScreenRes>X,Y
ScreenCapture>0,0,X,Y,C:\selectwarptozid.bmp
label>NextLoop
wait>1
IfFileExists>C:\stationundock.bmp,SecondFileFound
goto>NextLoop
Label>SecondFileFound
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\nextstargate.bmp,C:\selectwarptozid.bmp,0,1,X,Y,NumFound
If>NumFound>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
Aaron
-
- Newbie
- Posts: 6
- Joined: Wed Dec 17, 2008 2:11 am
thankyou for your help..
the control command sends a "space" its a shortcut within the game to stop the ojbect from moving
also i just uploaded the image as a jpeg because am lazy
but anyway back to the matter of my scrip
but the cursor ingame does not move
the cursor just flickers on the bottom left of the screen as if it is looking for the image but it must find it because it leaves the loop it just does not select the image.
also i cannot do the mouse,pos system because i want to send the script to a few mates of mine.
the control command sends a "space" its a shortcut within the game to stop the ojbect from moving
also i just uploaded the image as a jpeg because am lazy
but anyway back to the matter of my scrip
what this does at the min is undocks me from the station then stops my ship this is where the problem is because i think the script thinks its pressing the picture because it jumps out of the loopwait>30
GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\stationundock.bmp
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\undock_station.bmp,C:\stationundock.bmp,20,1,Xpos,Ypos,imgs3
If>imgs3>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
wait>20
press CTRL
send>
release CTRL
wait>10
GetScreenRes>X,Y
ScreenCapture>0,0,X,Y,C:\selectwarptozid.bmp
label>NextLoop
wait>1
IfFileExists>C:\stationundock.bmp,SecondFileFound
goto>NextLoop
Label>SecondFileFound
FindImagePos>C:\Users\beattie\Desktop\evemacro_pics\nextstargate.bmp,C:\selectwarptozid.bmp,20,1,Xpos,Ypos,NumFound
If>NumFound>0
MouseMove>Xpos_0,Ypos_0
Lclick
Endif
but the cursor ingame does not move
the cursor just flickers on the bottom left of the screen as if it is looking for the image but it must find it because it leaves the loop it just does not select the image.
also i cannot do the mouse,pos system because i want to send the script to a few mates of mine.
Checking for wrong secondfile
Do you mean
IfFileExists>C:\selectwarptozid.bmp,SecondFileFound
?
Gale
IfFileExists>C:\selectwarptozid.bmp,SecondFileFound
?
Gale
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
You are alredy using MouseMove, so your mates may have problem with this one also.
If you use MouseMoveRel vs. MouseMove, then your mates may probably be able to use the script because the X/Y positions will be relative to the window position and size.
If you use MouseMoveRel vs. MouseMove, then your mates may probably be able to use the script because the X/Y positions will be relative to the window position and size.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Yes, but he's using MouseMove to move to a position determined by FindImagePos. Therefore it does not matter where the object is as it is found and it's position determined for the MouseMove.Bob Hansen wrote:You are alredy using MouseMove, so your mates may have problem with this one also.
To the OP: Remember to capture your bitmaps using the built in Image Capture tool in Macro Scheduler.
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?
-
- Newbie
- Posts: 6
- Joined: Wed Dec 17, 2008 2:11 am
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
You are right, good catch Marcus, I missed that fine detail with just a brief scan of the commands.Yes, but he's using MouseMove to move to a position determined by FindImagePos. Therefore it does not matter where the object is as it is found and it's position determined for the MouseMove.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!