#115355 - 2004-03-02 10:02 PM
Read Registry Key and Set Value
|
Bob Deerinwater
Starting to like KiXtart
Registered: 2002-05-05
Posts: 101
Loc: Covina California
|
Hello, Here is what i am trying to accomplish. I have a need to read a registry key and set the value to "PPII". The key may only have one entry or it may have ten depending on how many printers are installed. Just need a push in the right direction.... The registry looks like this: [HKEY_CURRENT_USER\Software\Meditech\Wrkstn\INIPTPDRIVER] "HP LaserJet Series II"="HPLASERII" "HP LaserJet 4/4M"="HPLASERIIII" "HP LaserJet 4M Plus"="HPLASERIIII" "HP LaserJet 4M"="HPLASERIIII" "HP LaserJet 4"="HPLASERIIII" "\\\\ICC_ADMIN\\I31301"="PPII"
|
|
Top
|
|
|
|
#115357 - 2004-03-02 10:27 PM
Re: Read Registry Key and Set Value
|
MDavis
Fresh Scripter
Registered: 2004-01-05
Posts: 40
Loc: New Orleans, LA
|
Okay, I'm no expert, but this is what I would try
Code:
dim $val1, $r, $reg, $key
$reg = "HKEY_CURRENT_USER\Software\Meditech\Wrkstn\INIPTPDRIVER" $key = "\\\\ICC_ADMIN\\I31301"
If KeyExist($reg) $val1 = ReadValue($reg, $key) If NOT $val1 = "PPII" $r = WriteValue($reg, $key, "PPII","REG_SZ") Else EndIf
I think that should work?
_________________________
Micah Davis
"A truly wise man never plays leapfrog with a unicorn."
|
|
Top
|
|
|
|
#115358 - 2004-03-02 10:33 PM
Re: Read Registry Key and Set Value
|
Bob Deerinwater
Starting to like KiXtart
Registered: 2002-05-05
Posts: 101
Loc: Covina California
|
The value that i want to change is the "HPLaser**" the need to be changed to PPII. I will start looking at the suggestions. Thank You
|
|
Top
|
|
|
|
#115362 - 2004-03-03 04:43 PM
Re: Read Registry Key and Set Value
|
Bob Deerinwater
Starting to like KiXtart
Registered: 2002-05-05
Posts: 101
Loc: Covina California
|
Thanks for the help on this. After further investigation i found that changing the HPLASER value would not help. It appear that the program read the default printer and the adds it to the INIPTPDRIVER registry key (hope my terminology is correct) and then sets the value to "" so i have changed the script to replace the "" with "PPII" here is the code. i added the call to the udf is that needed? Code:
Call w:\arrayenumvalue.udf $Print='HKEY_CURRENT_USER\Software\Meditech\Wrkstn\INIPTPDRIVER' $values=arrayenumvalue($Print) For Each $value In $values $data=ReadValue($Print,$value) If Left($data,1)='' $rc=WriteValue($Print,$value,'PPII','REG_SZ') EndIf Next
Thank again. This place is awesome!!!!!
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 781 anonymous users online.
|
|
|