Infrin Posted March 27, 2009 Share Posted March 27, 2009 Hey Guys,I have been trying to get AutoIT to read the registry to see if three keys exist. I have it set that if it @Error is set that it will create a file with the computer name and exit the script. I have modified this script in at least three different If..Then structures, but I have yet to use a Case statement. Any help would be greatly appreciated! Here is my script:P.S. If you noticed at the end of each regread there is a commented part, this is so if I needed to I could read a value, which I don't necessarily want, instead of just the key itself. Example:original: $registry = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Systems\A\", "");, "Client_AdapterURL") modified: $registry = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Systems\A\", "Client_AdapterURL") #include <file.au3> filecopy("*.*", "C:\Windows\Temp\*.*", 1) run("C:\windows\temp\7.bat") sleep (10000) MsgBox (0, "done", "done") $registry = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Systems\A\", "");, "Client_AdapterURL") If @Error Then failed() EndIf $registry2 = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Systems\Agent\", "");\Capture\CurrentVersion", "AgentLogAppend") If @Error Then failed() EndIf $registry3 = regread("HKEY_LOCAL_MACHINE\SOFTWARE\Witness\Install\", "");\A", "Version") If @Error Then failed() EndIf success() Func success() $computername = "Success\" & @ComputerName _FileCreate($computername) Exit EndFunc Func failed() $computername = "Failed\" & @ComputerName _FileCreate($computername) Exit EndFunc 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