Jump to content

Recommended Posts

Posted

hey all,

Just looking to see if anyone can help me?

I have 2 points say (x,y) and (x1,y1).

Now (x,y) is the top left point of a rectangle(for example)

and (x1,y1) is the bottom right point of the rectangle.

How would I say this in an if statement?

EG.

If $my_data is not between these 2 points ---> exit.

else ...do_whatever...

Endif

Posted

What is the name of the application you wish to interact with? There may be a much better way to interact with the controls than Pixel search. Pixel search is one of the most unreliable methods to use. You are much better to use things such as controlclick and controlsend.

I just had two sets of data in a pdf that I want to make a range. and i want all my data to be within that range

Posted

This is it:

;; This script is guaranteed to exit

Global $x1=0, $y1=0, $x2=320, $y2=320
Global $MYDATA[2] = [234,345]

If $MYDATA[0] >= $x1 and $MYDATA[0] <= $x2 then
  If $MYDATA[1] >=$y1 and $MYDATA[1] <= $y2 then
    _DoSomething()
      else
        Exit
  EndIf
    else
   Exit
EndIf

Func _DoSomething()
msgbox(64, '', 'The point is inside')
EndFunc

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Posted

Great example!

"Great" - I don't think so.

One If statement with three And's would be a better example, IMO.

Four nested If statements would have been worse.

Posted

One If statement with three And's would be a better example, IMO

Alright, so here we go:

;; This script is guaranteed to exit

Global $x1=0, $y1=0, $x2=320, $y2=320
Global $MYDATA[2] = [345,345]

If $MYDATA[0] >= $x1 and $MYDATA[0] <= $x2 and $MYDATA[1] >=$y1 and $MYDATA[1] <= $y2 then
    _DoSomething()
      else
        Exit
  EndIf

Func _DoSomething()
msgbox(64, '', 'The point is inside')
EndFunc

:sweating: Undoubtedly, this one is better, since it saves me nesting.

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Posted

You are welcome indeed. However, I suggest you to use the example in Post-7 of this thread. It's much better than the first one (which you have quoted).

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

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
  • Recently Browsing   0 members

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