GregP Posted August 25, 2005 Share Posted August 25, 2005 Here goes another dumb newbie question - I am trying to check for the version of an application installed on a workstation by using the RegRead command. The conditional statement following the RegRead command is not working as expected ...... =============================================== $HFM = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION") MsgBox(32,"DEBUG","The value of $HFM is " & $HFM) ;;;;;; ;;;; The value returned in the msgbox is 3.5.0.0.384 ;;;;;;;;;;;;;;;;;;;;;;;; IF $HFM = "3.5.0.0.384" Then MsgBox(32,"DEBUG","The value of $HFM is" & $HFM) ===================================================== The conditional statement fails with the "=" if I change it to "<>" the conditional statement works? What am I doing wrong ? Thanks, Greg Link to comment Share on other sites More sharing options...
seandisanti Posted August 25, 2005 Share Posted August 25, 2005 Here goes another dumb newbie question -I am trying to check for the version of an application installed on a workstation by using the RegRead command. The conditional statement following the RegRead command is not working as expected ......===============================================$HFM = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION")MsgBox(32,"DEBUG","The value of $HFM is " & $HFM);;;;;; ;;;; The value returned in the msgbox is 3.5.0.0.384 ;;;;;;;;;;;;;;;;;;;;;;;;IF $HFM = "3.5.0.0.384" Then MsgBox(32,"DEBUG","The value of $HFM is" & $HFM) =====================================================The conditional statement fails with the "=" if I change it to "<>" the conditional statement works? What am I doing wrong ?Thanks,Greg<{POST_SNAPBACK}>it's possible that you're missing a character (a space etc) when taking the value from the messagebox. another thing you could do is:$HFM = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION") ClipPut($hfm)execute that as a script by itself, then paste the value between double quotes as your value to compare $HFM to. Link to comment Share on other sites More sharing options...
GregP Posted August 25, 2005 Author Share Posted August 25, 2005 it's possible that you're missing a character (a space etc) when taking the value from the messagebox. another thing you could do is:$HFM = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION") ClipPut($hfm)execute that as a script by itself, then paste the value between double quotes as your value to compare $HFM to.<{POST_SNAPBACK}>You are good .... there was a space at the end that wasn't appearing in the msgbox -I changed the code to:MsgBox(32,"DEBUG","The value of $HFM is" & $HFM & "A")and was able to see the space.Thanks for your help! Link to comment Share on other sites More sharing options...
seandisanti Posted August 25, 2005 Share Posted August 25, 2005 You are good .... there was a space at the end that wasn't appearing in the msgbox -I changed the code to:MsgBox(32,"DEBUG","The value of $HFM is" & $HFM & "A")and was able to see the space.Thanks for your help! <{POST_SNAPBACK}>no prob, glad to help Link to comment Share on other sites More sharing options...
Danny35d Posted August 26, 2005 Share Posted August 26, 2005 Here goes another dumb newbie question -I am trying to check for the version of an application installed on a workstation by using the RegRead command. The conditional statement following the RegRead command is not working as expected ......===============================================$HFM = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION")MsgBox(32,"DEBUG","The value of $HFM is " & $HFM);;;;;; ;;;; The value returned in the msgbox is 3.5.0.0.384 ;;;;;;;;;;;;;;;;;;;;;;;;IF $HFM = "3.5.0.0.384" Then MsgBox(32,"DEBUG","The value of $HFM is" & $HFM) =====================================================The conditional statement fails with the "=" if I change it to "<>" the conditional statement works? What am I doing wrong ?Thanks,Greg<{POST_SNAPBACK}>Another function that you can use is StringStripWS("String", 3) The number 3 tell the function to remove all space at the front and end of the string.$HFM = StringStripWS(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION"), 3)IF $HFM = "3.5.0.0.384" Then MsgBox(32,"DEBUG","The value of $HFM is" & $HFM) I think this way is better because if one of the computer that you are running the script doesn't have the space at the end then your script won't know if is the right installation or not AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
seandisanti Posted August 26, 2005 Share Posted August 26, 2005 Another function that you can use is StringStripWS("String", 3) The number 3 tell the function to remove all space at the front and end of the string.$HFM = StringStripWS(RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION"), 3)IF $HFM = "3.5.0.0.384" Then MsgBox(32,"DEBUG","The value of $HFM is" & $HFM) I think this way is better because if one of the computer that you are running the script doesn't have the space at the end then your script won't know if is the right installation or not<{POST_SNAPBACK}>actually, because the version number placed in registry by the installer, then all installs of the same version should have the same value (space included). and any other version doesn't meet the condition, regardless of the space or not...of course you could create hypothetical situations where it's a different build of the same version where they modified that, but didn't increment the build number in the version declaration in the registry you could end up with a false condition fail. To that i'd say that even if they didn't increment the build number, it's technically not the same product and the condition should fail. Link to comment Share on other sites More sharing options...
LxP Posted August 27, 2005 Share Posted August 27, 2005 Taking advantage of the StringInStr() function would prevent spaces in the string from being a problem, and you could also do nifty things like disregard subversions using this trick.; if version is of the 3.5.0.0 branch: if stringInStr($hfm, "3.5.0.0.") then ; if version is of the 3.5 branch: if stringInStr($hfm, "3.5.") then 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