Teckx

Help with IF THEN ELSE please

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#3 ·  Posted

12 minutes ago, Jos said:

How did you determine that?

Jos

I hid the first image from view and the 2nd never initiated

Share this post


Link to post
Share on other sites

#4 ·  Posted

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 


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted

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

 

Share this post


Link to post
Share on other sites

#6 ·  Posted

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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