olo Posted April 15, 2013 Share Posted April 15, 2013 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 Link to comment Share on other sites More sharing options...
Bert Posted April 15, 2013 Share Posted April 15, 2013 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. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
olo Posted April 15, 2013 Author Share Posted April 15, 2013 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 Link to comment Share on other sites More sharing options...
stormbreaker Posted April 15, 2013 Share Posted April 15, 2013 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 Link to comment Share on other sites More sharing options...
Bert Posted April 15, 2013 Share Posted April 15, 2013 Great example! The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Malkey Posted April 15, 2013 Share Posted April 15, 2013 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. Link to comment Share on other sites More sharing options...
stormbreaker Posted April 16, 2013 Share Posted April 16, 2013 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 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 Link to comment Share on other sites More sharing options...
Bert Posted April 16, 2013 Share Posted April 16, 2013 "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.And you don't actually provide the example. You just complain about other folks who give praise. >_< The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
olo Posted April 16, 2013 Author Share Posted April 16, 2013 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 Thanks man! Link to comment Share on other sites More sharing options...
stormbreaker Posted April 17, 2013 Share Posted April 17, 2013 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). olo 1 ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now