Jump to content

Exit if registry key exist


Recommended Posts

Hi,

Does anyone know the best way to handle a situation where an autoit script looks for a certain registry key and if it finds it than exits?

Any workarounds for If RegKeyExists and RegValueExists type functions?

Thanks in advance

Edited by autoitNOW
An ADVOCATE for AutoIT
Link to comment
Share on other sites

  • 3 weeks later...

Yeah....

Last time i checked i couldnt make autoit search the registry, so my amazing workaround is:

run regedit, export to .reg file, rename to .txt open with notepad, scroll through each line, copy to clipboard, maniuplate string to get the keynames.

Much fun it is too. I wrote a little app to wipe out registry entries of virus's that Sophos Antivirus picks up.

Sitting comfortably behind the code.

Link to comment
Share on other sites

I don't know about the stable version but in the unstable version RegRead has a few nice @error-codes:

Success: Returns the requested registry value value..

Failure: Returns numeric 1 and sets the @error flag:

    1 if unable to open requested key

-1 if unable to open requested value

-2 if value type not supported

So just check if @error is 1 or -1. This should do the trick.
Link to comment
Share on other sites

My bad, i read his question wrong... i thought he said an "uncertain" registry key... i.e, he knew the value of the key, but not the keyname... and yes, your correct its in the helpfile, and yes, i read your post wrong too, i thought you were reffering to the unstable RegSearch.

Sitting comfortably behind the code.

Link to comment
Share on other sites

$mom = RegRead("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main", "Start Page")

IF $mom = "http://www.microsoft.com" THEN Exit

Edited by Doxie

Were ever i lay my script is my home...

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