Jump to content
Sign in to follow this  
Nova

Reg check

Recommended Posts

Nova

Hi im trying to write a script to check to see if a reg key exists, and if it dosent create the missing key

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "A")

If @error = 0 Then 
    MsgBox(4096, "Yes")
    Else 
        MsgBox(4096, "No")
Endif

Can someone explain why the above code dosent do so ?

Edited by nova

Share this post


Link to post
Share on other sites
JSThePatriot

This is how to do that properly.. you never told it to write a key you are just reading to see if it is there...

If Not(RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "IPSend.exe")) Then
RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "IPSend.exe", "REG_SZ", @ScriptFullPath)
EndIF

Hope this helps a bit,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
Nova

Edit: Mistake !

Edited by nova

Share this post


Link to post
Share on other sites
Jos

Hi im trying to write a script to check to see if a reg key exists, and if it dosent create the missing key

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "A")

If @error = 0 Then 
    MsgBox(4096, "Yes")
    Else 
        MsgBox(4096, "No")
Endif

Can someone explain why the above code dosent do so ?

<{POST_SNAPBACK}>

Think you have a syntax error in the MSGBOX() commands....

When thats fixed it works for me...

Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Nova

Think you have a syntax error in the MSGBOX() commands....

Dammit, I hate getting the simple stuff wrong, thats what happens when you rush

Tnx

Share this post


Link to post
Share on other sites
JSThePatriot

I dont understand what the above code is doing...

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites
Jos

I dont understand what the above code is doing...

JS

<{POST_SNAPBACK}>

Only tests if the registry key exists....

normally you would do something like this i guess;

$a = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "A")
If @error = 0 Then 
   MsgBox(4096, "Yes", $a)
Else 
   MsgBox(4096, "No", "no")
EndIf

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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
Sign in to follow this  

×