Jump to content

Help with IF THEN ELSE please


Recommended Posts

for some reason the script will not make it past the first if statement. I want it to goto the second one if the first one fails

$result = _ImageSearch("supv2.png",1,$x1,$y1,0)
If $result=1 Then
   MouseMove($x1,$y1,3)
   MouseClick("left",$x1,$y1,1)
Else
   $result = _ImageSearch("supv1.png",1,$x1,$y1,0) 
   If $result=1 Then
      MouseMove($x1,$y1,3)
      MouseClick("left",$x1,$y1,1)
   EndIf
EndIf

 

Edited by Jos
Link to comment
Share on other sites

  • Developers

So, how does that prove that it doesn't get past the first if?

Add a MsgBox() at strategic places in the code and check that way and stop Assuming!

Jos 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

4 minutes ago, Jos said:

So, how does that prove that it doesn't get past the first if?

Add a MsgBox() at strategic places in the code and check that way and stop Assuming!

Jos 

well I know it didn't get there because I removed some commands that never activate which I edited out of my first post bc of clutter

 

aside from whether I entered message boxes etc, is my function correct? im noticing the images are not always hitting 100% and this may be the case here

I tried adding $tolerance but it does not seem to work or im entering it incorrectly

$result = _ImageSearch("ticketnotes.png",1,$x1,$y1,X)    X = Tolerance field right?

 

 

here is what I have ,, its messy that's why  I removed it from here

$result = _ImageSearch("supv2.png",1,$x1,$y1,0)
If $result=1 Then
   MouseMove($x1,$y1,3)
   MouseClick("left",$x1,$y1,1)
   Send("{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}")
Else
   $result = _ImageSearch("supv1.png",1,$x1,$y1,0) 
   If $result=1 Then
      MouseMove($x1,$y1,3)
      MouseClick("left",$x1,$y1,1)
      Send("{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTDOWN}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{RIGHT}{SHIFTUP}{CTRLDOWN}c{CTRLUP}")
   EndIf
EndIf

 

Link to comment
Share on other sites

  • Developers
1 minute ago, Teckx said:

$result = _ImageSearch("ticketnotes.png",1,$x1,$y1,X)    X = Tolerance field right?

No idea, this isn't a standard function.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...