Sign in to follow this  
Followers 0
pdark1987

need help with imagesearch

1 post in this topic

#1 ·  Posted (edited)

#include <ImageSearch.au3>
#include <ScreenCapture.au3>


$X = 0         ;need this? if im using $IMR0101= _ImageSearch('doc.bmp', 0, $X, $Y, 0) would i need it then?
$Y = 0        ;  ''

HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "Close")
HotKeySet("{F3}", "Pause")

_startup()

Func _startup()
   ToolTip("startup",0,0)
   While 1
      sleep(1000)
      WEnd
   EndFunc

Func Close()
   Exit
EndFunc

Func Pause()
   ToolTip("Pause",0,0)
   While 1
      sleep(100)
   WEnd
EndFunc

Func start()
   ToolTip("",0,0)
   MouseClick("left" , 375, 1109, 1) ;home windows app
   While 1
   $is = _ImageSearch('pap.png', 303, 526, 311, 545)   ; question 1
   IF $is = 1 Then
      sleep(250)
      MouseClick("left",1,10) ;  question 2
      sleep(500)
      MouseClick("left" , 555, 1106, 1) ;switch windows          
      sleep(2000)
      MouseClickDrag("left", 438, 890, 164, 1000) ;close  app
      sleep(500)
      IMR()
   EndIf
    MsgBox($MB_SYSTEMMODAL, "", "An error occurred.")
      WEnd
   EndFunc

at question 1, that commend is going to search for an image at those values right?

at question 2, is the mouse going to click at the value where pap.png is found or it just going to click left anywhere? if so how can i make it so it click in between or the location of the image?

 

i have used 

 $IMR0101= _ImageSearch('doc.bmp', 0, $X, $Y, 0) if $IMR0101 = 1 Then
MouseClick("left",$x,$y,1,10)
but sometimes it does work for me
so thats why i was wondering if there a better way of doing it
 
 
also i tried
  Func IMR81()
Do
sleep(300)
Until
$IMR81= _ImageSearch('ok.png', 370, 612, 391, 614)
if $IMR81 = 1 Then
MouseClick("left",375,612,1,10)
sleep(1000)
IMR8()
Else
MsgBox($MB_SYSTEMMODAL, "", "An error occurred.")
EndIf
   EndFunc

and i get until error

but is it possible to do is;  sleep until the image appears then  left click? cuz the image appears quick or slow based on the internet connection

Edited by pdark1987

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0