Jump to content

Return Value


Guest atenspro
 Share

Recommended Posts

Guest atenspro

I modified the example in the help under "Registry Management" for RegDelete to create a script. It works fine and deletes the registry value I need to delete. But it doesn't give me a return value, or at least I can't see the return value (or maybe I don't know where to look for the return value?). It would be great to see a value to know it was successful instead of using regedit to verify it. I may be doing it all wrong. But it does delete the value.

Here is my script:

RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "MyValue")

If it's possible, I would like to see these values taken from the help file for AutoIt:

Return Value:

Success: Returns 1.

Special: Returns 0 if the key/value does not exist.

Failure: Returns 2 if error deleting key/value.

I apologize if my question isn't clear. If you need more info just ask.

Thanks in advance for any help you can give me.

Link to comment
Share on other sites

Guest atenspro

$val = RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "MyValue")
MsgBox(0,"Value",$val)

<{POST_SNAPBACK}>

It worked! Thanks for "schoolin me" :whistle:
Link to comment
Share on other sites

Guest atenspro

Now I have another question.

Is there a way to get a return value that spells it out rather than just a number?

I mean that says "Successfully deleted" or "Value does not exist" or "Error deleting value".

Thanks again for your quick response and the correct answer to my first question.

Link to comment
Share on other sites

Normally no, usually a scripter creates conditions

example

$val = RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "MyValue")

if $val = 0 then
  MsgBox(0,"RegDelete","key/value does not exist")
elseif $val = 1 then
  MsgBox(0,"RegDelete", "Successfull")
elseif $val = 2 then
  MsgBox(0,"RegDelete", "error deleting key/value")
endif

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Guest atenspro

gafrost.....Thanks again!

It's been many years since I played around with "Basic" but this reminds me of that time. Your conditional statements were perfect for what I was trying to do.

Thanks again for taking the time to spell it out for me. :whistle:

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