Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


check registry value if empty

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,29699
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> check registry value if empty
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 check registry value if empty - 1/11/2006 2:14:13 AM   
  linstead

 

Posts: 23
Score: 0
Joined: 6/30/2005
From:
Status: offline
i want to check if a registry is blank and if it's them msgbox to please sync otherwise continue the install but i can't get it to check the registry value

If IsNull(strRegPath1)=Truel Then

MsgBox "please enter information"
Else

strRegPath1 = g_oShell.RegRead ("HKCU\SOFTWARE\procent\activeuser\Preferences\LastUserName")

g_oShell.RegWrite "HKCU\SOFTWARE\lanexpert\Install\user", strRegPath1, "REG_SZ"

End If
 
 
Post #: 1
 
 RE: check registry value if empty - 1/11/2006 2:31:07 AM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Something like this:

Set oShell = CreateObject("Wscript.Shell")
On Error Resume Next
strKey = "Path you are searching for"
strKeyValue = oShell.RegRead(strKey)

If Err.number <> 0 Then
    On Error Goto 0
    wscript.echo "Not Found"
Else
    wscript.echo strKeyValue
End If

(in reply to linstead)
 
 
Post #: 2
 
 RE: check registry value if empty - 1/11/2006 7:22:43 AM   
  linstead

 

Posts: 23
Score: 0
Joined: 6/30/2005
From:
Status: offline
that didn't answer the my question,
i want to check if the value is empty and if it's empty them msgbox else continue with the script

(in reply to linstead)
 
 
Post #: 3
 
 RE: check registry value if empty - 1/11/2006 7:26:34 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
Set oShell = CreateObject("Wscript.Shell")
On Error Resume Next
strKey = "Path you are searching for"
strKeyValue = oShell.RegRead(strKey)

If Err.number <> 0 Or strKeyValue = "" Then
    'DO WHATEVER YOU WANT TO DO FOR AN EMPTY VALUE HERE
End If

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to linstead)
 
 
Post #: 4
 
 RE: check registry value if empty - 1/11/2006 8:06:43 AM   
  linstead

 

Posts: 23
Score: 0
Joined: 6/30/2005
From:
Status: offline
thank you very much for you help

(in reply to linstead)
 
 
Post #: 5
 
 RE: check registry value if empty - 1/11/2006 8:29:20 AM   
  Country73


Posts: 733
Score: 10
Joined: 8/25/2004
From: USA
Status: offline
Did I just miss something here?

(in reply to ebgreen)
 
 
Post #: 6
 
 RE: check registry value if empty - 1/11/2006 8:30:51 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
What you provided would have accounted for the value not being present at all. All I added was to handle if the value was present but had a value of "".

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Country73)
 
 
Post #: 7
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> check registry value if empty Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts