pieeater Posted May 31, 2011 Share Posted May 31, 2011 (edited) im trying to check if a point is between two set points using stringregexp. i know i can do it this way: if ... > ... and ... < ... and ... > ... and < ... then however im trying to check it through stringregexp. if its possable. heres what i tried: #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Misc.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 554, 312, 331, 130) $click = GUICtrlCreateGroup("click", 144, 64, 249, 161) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch $mp = MouseGetPos() $mp1 = BinaryToString($mp[0]) $mp2 = BinaryToString($mp[1]) If _IsPressed(01) and StringRegExp($mp1, "{144, 393}", 0) = 1 And StringRegExp($mp2, "{64, 225}") = 1 Then MsgBox(0, "", "") WEnd Edited May 31, 2011 by pieeater [spoiler]My UDFs: Login UDF[/spoiler] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 31, 2011 Moderators Share Posted May 31, 2011 (edited) Regular expressions is definitely not the means to solve this issue.You're asking for a "String"/"Char" type function to do "Number/Integer" type operation, even if it works, it's not a good way to approach it.Why not just make a simple func to do it.eg.Func __IsBetween($n_num, $n_pt1, $n_pt2) If Number($n_num) <= Number($n_pt1) Then Return False If Number($n_num) >= Number($n_pt2) Then Return False Return True EndFuncpseudo:If IsArray($mp) Then If _IsPressed(01) Then If __IsBetween($mp[0], 144, 393) And __IsBetween($mp[1], 64, 225) Then MsgBox(0, "", "") EndIf EndIf EndIf Edited May 31, 2011 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
pieeater Posted May 31, 2011 Author Share Posted May 31, 2011 i didnt think that it would work well thanks for replying [spoiler]My UDFs: Login UDF[/spoiler] 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