Shonnie Posted November 11, 2007 Share Posted November 11, 2007 (edited) Trying to get a value, and see if it equals another value $Life = StringSplit(_IEBodyReadText($oIE), @CR) $Life2 = StringSplit($Life[3], ":") $Life3 = StringSplit($Life2[2], "/") $CheckLife = StringRegExp($Life3[1], $Life3[2], 0) If $CheckLife = 1 Then MsgBox(0, "", "Good ! " & $Life3[1] & "/" & $Life3[2]) Else MsgBox(0, "", "Bad ! " & $Life3[1] & "/" & $Life3[2]) EndIf Tried this too: If StringRegExp($Life3[1], $Life3[2], 0) = 0 Then $Wait = 1 Else $Wait = 0 EndIf Neither worked, always turns up as 0, I even made a message box to show the values, so I could confirm. Searched the help files and forums, any and all methods I came across didnt work Also saw that StringInStr doesn't work Maybe it's because they are numbers, and need to be stored as text? I think I awnsered my own question $Life4 = String($Life3[1]) $Life5 = String($Life3[2]) $result = StringCompare($Life4, $Life4) If $result = 0 Then MsgBox(0, "", "Woot") ElseIf $result < 0 Then MsgBox(0, "", "Boo!") Else MsgBox(0, "", "Huh?") EndIf Tried converting the values I want to compare to strings, and then using StringCompare, but it always turns up with 'Huh?', so I don't think they are even getting compared Help appreciated Edited November 11, 2007 by Shonnie Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 11, 2007 Moderators Share Posted November 11, 2007 If you don't know how to use regular expressions, you'll need to take a week or two and study them (plenty of tutorials on the net).What you have is nothing more than a StringInStr() option with the RegExp functions you are using. 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...
Shonnie Posted November 11, 2007 Author Share Posted November 11, 2007 (edited) Is there a mighty simple way to compare 2 numbers?I also tried == operands instead of = but to no avail Btw, I read the article on Wikipedia about regular expressions, but this is all working with strings, right?The only reason I resorted to this was because I could not find any way to compare 2 numbers, or none that workedPerhaps they just dont equal each other? I output to a messagebox, with periods infront and before the number, to make sure theres no trailing spaces or anything, and there isn't Edited November 11, 2007 by Shonnie Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 11, 2007 Moderators Share Posted November 11, 2007 (edited) Is there a mighty simple way to compare 2 numbers?I also tried == operands instead of = but to no avail If Number($var) = Number($var2) Then Edited November 11, 2007 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...
Shonnie Posted November 11, 2007 Author Share Posted November 11, 2007 Wow ! My awnser lies in numbers, therefor I must convert them TO numbers, FROM strings ! You sir, are a genius Link to comment Share on other sites More sharing options...
BrettF Posted November 11, 2007 Share Posted November 11, 2007 Wow ! My awnser lies in numbers, therefor I must convert them TO numbers, FROM strings !You sir, are a genius Yes suh, he is such a genius... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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