Page 1 of 1 1
Topic Options
#124449 - 2004-08-04 07:00 PM Looking for a registry script
Pooz Offline
Lurker

Registered: 2004-08-04
Posts: 4
Hi everyone - I hope someone can help me out with this.

1. Scan registry
2. Check for a value name in a specific folder (Specific folder: HKEY_LOCAL_MACHINE\.....\, Value name: PromptData)
3. If value name does not exist, END.
4. If value name does exist, delete key entirely.
5. END

Thanks!

Top
#124450 - 2004-08-04 07:01 PM Re: Looking for a registry script
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Sure... check the manual for ReadValue() and DelKey(). There should even be examples.
Top
#124451 - 2004-08-04 07:03 PM Re: Looking for a registry script
Pooz Offline
Lurker

Registered: 2004-08-04
Posts: 4
I saw those two examples in the manual, but I'm not sure how to integrate them together.

Oh yeah, I'm a noobie


Edited by Pooz (2004-08-04 07:04 PM)

Top
#124452 - 2004-08-04 07:04 PM Re: Looking for a registry script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Not sure though why you would need to scan the registry if you know the specific location of the value and the key.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124453 - 2004-08-04 07:05 PM Re: Looking for a registry script
Pooz Offline
Lurker

Registered: 2004-08-04
Posts: 4
Well I wasn't sure how to word it exactly - my mistake.

Yes, I know the key and want to delete it if it exists.

Thanks

Top
#124454 - 2004-08-04 07:11 PM Re: Looking for a registry script
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Well in my best teach a man to fish mode, it would be something like (but you'll have to finish yourself)...

Code:

If ReadValue("HKLM\SomeSubKey","SomeValue")
If DelKey("HKLM\SomeSubKey")
"An error occured: " + @SERROR ?
EndIf
EndIf


Top
#124455 - 2004-08-04 07:14 PM Re: Looking for a registry script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
If checking for the Value "Name" and not the Value "Data", then something like this should work:

Code:
break on

If ReadValue('HKEY_CURRENT_USER\Software\KiXtart','foo') <> ''
$rc = DelKey('HKEY_CURRENT_USER\Software\KiXtart\New Key')
EndIf



Edited by Les (2004-08-04 07:15 PM)
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124456 - 2004-08-04 07:19 PM Re: Looking for a registry script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Actually, that code is what I call "cheap and dirty logic". If the value data for the value name is blank, it will bite. The more bulletproof way would be to EnumValue() all the values.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#124457 - 2004-08-04 10:24 PM Re: Looking for a registry script
Pooz Offline
Lurker

Registered: 2004-08-04
Posts: 4
Quote:

Well in my best teach a man to fish mode, it would be something like (but you'll have to finish yourself)...

Code:

If ReadValue("HKLM\SomeSubKey","SomeValue")
If DelKey("HKLM\SomeSubKey")
"An error occured: " + @SERROR ?
EndIf
EndIf






Used this code and it worked great - thank you!

EDIT - Nevermind about what I just deleted - I don't know what I was thinking....


Edited by Pooz (2004-08-04 10:25 PM)

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2175 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.061 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org