Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RegRead gives VBscript error

Status
Not open for further replies.

sfriday

IS-IT--Management
Feb 23, 2002
211
DE
I am trying to read a string from the registry, I am using

Dim Wsh, Wallpaper
Set Wsh = WScript.CreateObject("WScript.Shell")
set wallpaper = wsh.RegRead("HKCU\CONTROL PANEL\DESKTOP\SCRNSAVE.EXE")
msgbox wallpaper

However when I run it I get a VBSCRIPT RUNTIME Error OBJECT Required: '[String:"(NONE)"]

NONE is the correct responce but why does it error and not displaye in the MSGBOX

Thanks
Steve
 
OK I resolved that last one by using

MSGBOX wsh.RegRead("HKCU\CONTROL PANEL\DESKTOP\SCRNSAVE.EXE"

However why can I not assign it to a variable with the Set command shown earlier

Steve
 
The Set statement is for assigning object references to variables.

To assign numeric,string,boolean,etc.. values, use the assignment operator, =.

wallpaper = wsh.RegRead("HKCU\CONTROL PANEL\DESKTOP\SCRNSAVE.EXE") Jon Hawkins
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top