Jump to content

Need help with RegRead


GregP
 Share

Recommended Posts

I'm trying to determine if an application is installed by using RegRead. Based on the Autoit Help - I believe my syntax is correct. I'm testing on a W2K pc that has the registry key. I created a msgbox - to see the what is in the variable - but it returns nothing. The registry key type is "REG_SZ" and the value is "3.5.0.0.384". Any help would be greatly appreciated.

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

$HFM = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION")

MsgBox(32,"DEBUG","The value of $HFM is", $HFM)

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

Greg

Link to comment
Share on other sites

uhm is that msgbox correct? Shouldn't it be MsgBox(32,"DEBUG","The value of $HFM is" & $HFM)

<{POST_SNAPBACK}>

Thanks for the feedback ...... per the Autoit Help on RegRead gives the following example

==========================================

$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft Windows\CurrentVersion", "ProgramFilesDir")

MsbBox(4096, "Program files ar in:", $var)

=========================================

I tried adding the & in my script and got a "Error in Expression" message.

Greg

Link to comment
Share on other sites

Nooo you did

MsgBox(32,"DEBUG","The value of $HFM is", $HFM)

Notice there are 4 ,'s when there should be 3. (flag,title,message,[timeout])

so you are telling it:

Flag = 32

Title = Debug

Msg = The value of $HFM is

Timeout = $HFM

When it should be:

MsgBox(32,"DEBUG","The value of $HFM is" & $HFM)

            Flag,     Title,"msg

Flag = 32

Title = Debug

Msg =The value of $HFM is & $HFM

Edited by SupraNatural

Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!

Link to comment
Share on other sites

uhm is that msgbox correct? Shouldn't it be MsgBox(32,"DEBUG","The value of $HFM is" & $HFM)

<{POST_SNAPBACK}>

yep

***edit***

just to elaborate - the comma between the values tells the message box that the last value is a seperate argument, which obviously you're not tyring to do. you're trying to concatenate the strings, which is done with the '&' not the ",". lose the comma, add an '&' and you're all set.

Edited by cameronsdad
Link to comment
Share on other sites

yep

***edit***

just to elaborate - the comma between the values tells the message box that the last value is a seperate argument, which obviously you're not tyring to do.  you're trying to concatenate the strings, which is done with the '&' not the ",".  lose the comma, add an '&' and you're all set.

<{POST_SNAPBACK}>

exactly

p.s. has the autoit site been going down for anyone else?

Visit http://www.blizzedout.com/forums/register....referrerid=8306 for the top blizzard hacks. WoW, TfT, D2/LOD, CS. You name it we got it!

Link to comment
Share on other sites

Thanks for the feedback ......  per the Autoit Help on RegRead gives the following example

==========================================

$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft Windows\CurrentVersion", "ProgramFilesDir")

MsbBox(4096, "Program files ar in:", $var)

=========================================

I tried adding the & in my script and got a "Error in Expression" message.

Greg

<{POST_SNAPBACK}>

The help file is correct and if you follow the example you should have used

MsgBox(4096, "The value of $HFM is", $HFM)

And that would have given you your answer.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Thanks for the feedback ......  per the Autoit Help on RegRead gives the following example

==========================================

$var = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft Windows\CurrentVersion", "ProgramFilesDir")

MsbBox(4096, "Program files ar in:", $var)

=========================================

I tried adding the & in my script and got a "Error in Expression" message.

Greg

<{POST_SNAPBACK}>

If you look at the help example between the parenthesis there are only two commas; meaning MSGBOX(flag, title, text) in your syntax you have between the parenthesis tree commas:

MsgBox(32,"DEBUG","The value of $HFM is", $HFM)

and like SupraNatural said:

MsgBox(32,"DEBUG","The value of $HFM is" & $HFM)

change the last , to & and the script will work....

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

Nooo you did

Notice there are 4 ,'s when there should be 3. (flag,title,message,[timeout])

so you are telling it:

Flag = 32

Title = Debug

Msg = The value of $HFM is

Timeout = $HFM

When it should be:

Flag = 32

Title = Debug

Msg =The value of $HFM is" & $HFM

<{POST_SNAPBACK}>

Ok - I think were a little off-track here - my original code was:

===========================================

$HFM = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION")

IF $HFM = "3.5.0.0.384" Then

====================================================

The IF statement was continually failing - so I added the following to determine if the RegRead command was working correctly

================================================

MsgBox(32,"DEBUG","The value of $HFM is", $HFM)

================================================

The MsgBox was returning "The value of $HFM is "

====================================================

Per your reply I changed the msgbox to this

=====================================================

MsgBox(32,"DEBUG","The value of $HFM is", & $HFM)

==================================================

I got an Autoit Error - pointing to the &. Either way - just by the fact that the IF statement is failing - tells me that $HFM doesn't have any value. Is there anything

I'm doing wrong or should know about with the RegRead command??

Link to comment
Share on other sites

If you look at the help example between the parenthesis there are only two commas; meaning MSGBOX(flag, title, text) in your syntax you have between the parenthesis tree commas:

MsgBox(32,"DEBUG","The value of $HFM is", $HFM)

and like SupraNatural said:

MsgBox(32,"DEBUG","The value of $HFM is" & $HFM)

change the last , to & and the script will work....

<{POST_SNAPBACK}>

Sorry - I wasn't able to see all of the replies - either my browser or the Autoit website having a problem?

Ok - I change the syntax to

===============================================

$HFM = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Hyperion Solutions\Hyperion Financial Management\Install","VERSION")

MsgBox(32,"DEBUG","The value of $HFM is" & $HFM)

================================================

It returns the correct value! So there must be something going on with my IF statement code following the RegRead command.

Thanks for all your help!!!

===============================================

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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