Jump to content

Reg check


Nova
 Share

Recommended Posts

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
Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...