Sign in to follow this  
Followers 0
JLogan3o13

Error handling for RegDelete <solved>

7 posts in this topic

#1 ·  Posted (edited)

I'm currently working on a script that deletes a number of registry keys left over from an application uninstall. I have the script working, but am wondering about a clean way to manage error handling. In some instances, a key may not exist and would therefore throw an error. I can write an IF statement, but there are over 200 keys and that would be a mess. Is there a simple way to say have the script perform a task if any of the keys is non-existant or fails to delete - something like a DO...Until without having to declare each key?

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites



Should the script quit after an error or should it log it/throw up a message and then continue

Share this post


Link to post
Share on other sites

I've not decided 100% on the action I want to take, but I'm leaning toward doing a msgbox that times out after 5 seconds or so, and then continuing. That part I have and am comfortable with, just looking at the best way to check every line without a large number of statements or having to declare every key into an array.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I was going to suggest an Array, but I don't know of another solution if that does not work for you. How else would you get what keys need to be checked? If you have the uncompiled script, just use a decent editor to do a search/replace so you do not have to key in all of the lines from scratch. I have macros set up in TextPad that allow me to add the text in the clipboard to the beginning or the end of each line. Post your code and I can help

Edited by Varian

Share this post


Link to post
Share on other sites

or having to declare every key into an array.

Don't be stupid now, you have to use either, and an array would be an infinite times easier, so why not. Infinity is a large thing you know ;)

If you simply doesn't know how to handle arrays, see the Array Tutorial in the wiki. I could write you an example, but there's something good on TV starting now. See you tomorrow.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thanks for the offer of assistance Varian, but I believe I found a method that will work with the smallest overhead.

Never considered myself stupid Admiral, simply reaching out to those that may have more knowledge. I do know how to use the array functions, and stated my reasoning on avoiding it. I find, personally, that unnecessary nastiness in a forum is often a case of making assumptions about people you don't know - such as me, for example, believing the stereotype that all Swedish men with poor grammar are gay Posted Image - so I won't take offense to your comment. I'll be marking this as closed.

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

May I ask what your soultion was?

Thanks for the offer of assistance Varian, but I believe I found a method that will work with the smallest overhead.

Never considered myself stupid Admiral, simply reaching out to those that may have more knowledge. I do know how to use the array functions, and stated my reasoning on avoiding it. I find, personally, that unnecessary nastiness in a forum is often a case of making assumptions about people you don't know - such as me, for example, believing the stereotype that all Swedish men with poor grammar are gay Posted Image - so I won't take offense to your comment. I'll be marking this as closed.

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  
Followers 0