#190376 - 2008-10-29 08:38 PM
Checking if a sub key exists under "windows messaging subsystem"
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
Hi Guys,
Im Brand new to scripting full stop, not just kix.......bare with me :-)
Im trying to check if any keys exist under HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles.
Its driving me round the bend because i cant work it out. its easy to check to see if a key exists if you know what key your searching for by using keyexist, but what if you dont know what the key is called??
EG: if keyexist("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\*") ? "do this" else ? "do this" endif
if im being stupid please ask for my email address and send abuse at your leisure.
Thanks :-)
|
Top
|
|
|
|
#190381 - 2008-10-29 09:01 PM
Re: Checking if a sub key exists under "windows messaging subsystem"
[Re: Glenn Barnas]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
i looked at enumkey, but it kept confusing me. what i kept trying to do never worked, i loooked at the example on the kix reference section and tried to adapt. I.e,
$Index = 0 :Loop1 $KeyName = ENUMKEY(("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles\", $Index) If @ERROR > 0 $nokey = yes else if @error = 0 ? "Profile exists: $keyname" $Index = $Index + 1 goto Loop1 Endif
if $nokey = yes writevalue("..... writevalue("..... endif
probably complete rubbish!! but trying to get to grips with understanding it.
Teasing and abuse i can deal with, Im twelve years plus younger than the rest of my team at work...... thick skinned i have become!! :-)
Thanks again, and for the quick reply
|
Top
|
|
|
|
#190382 - 2008-10-29 09:07 PM
Re: Checking if a sub key exists under "windows messaging subsystem"
[Re: Reg_D]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
its more if keys are found i want it to do nothing, if they arent found i want to write registry values.
Make sense??
Cheers
|
Top
|
|
|
|
#190385 - 2008-10-29 09:25 PM
Re: Checking if a sub key exists under "windows messaging subsystem"
[Re: Glenn Barnas]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
well thats what ive wasted the last 2 days trying to do...... me, stupid......yes!!
i think the bit thats throwing me off is the 0 bit. is the zero saying if there is no value other than the 0 then do something, but if there is a value of "something" other than the 0 do something else??
sorry, i just like to know how and why things work rather than accept they work....
|
Top
|
|
|
|
#190386 - 2008-10-29 09:48 PM
Re: Checking if a sub key exists under "windows messaging subsystem"
[Re: Reg_D]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
Gonna get me a kix manual me thinks.
your help was much appreciated Glenn. no doubt ill darken your screen again soon.
:-) Adam
|
Top
|
|
|
|
#190387 - 2008-10-29 10:06 PM
Re: Checking if a sub key exists under "windows messaging subsystem"
[Re: Reg_D]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
When I went to IBM school many (many...) years ago, they taught me the first rule of computing - "Always start counting from zero, except when you start from one."
In other words.. if you're counting computer things, the first "thing" is "thing-0", otherwise it's "thing-1". First byte=0, first watermelon=1, but you still have one of each.
ERROR 0 means "no error, or Success!", any other value means some error occurred, so "If @ERROR" will do things if any error occurred.
The EnumXXX commands want an index, and since these are computer "things", the first index is what??? Zero! The first example incremented the $Index variable so you could work through the subkeys. Since you don't care if there are subkeys, only if there AREN'T subkeys, you just need to check the first index (0) and get back an error to know there's work to be done.
Glenn
BTW - the "manual" is on the home page of the site - be sure to put it back when you're done.
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#190391 - 2008-10-29 11:14 PM
Re: Checking if a sub key exists under "windows messaging subsystem"
[Re: Glenn Barnas]
|
Reg_D
Fresh Scripter
Registered: 2008-10-29
Posts: 12
|
That makes sense, thanks for sorting that out for me. think my head goes in a spin after a while.
have finished the script i needed thanks to you. testing tomorrow :-)
I hope there are no time limit or overdue fees incurred in borrowing it......im going to be needing it for quite a while!!! :-D
Again Glenn much appreciated. nice to have a community of people to fall back on like yourselves.
Take care
Adam
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 346 anonymous users online.
|
|
|