drmarvin Posted October 17, 2004 Share Posted October 17, 2004 I am having a little trouble using VBS to parse a reg entry for me. I'm attempting to have this file launch WPI, because I only want to edit WPI config in one spot on my Multiboot DVD, so I have a VBS file in the $OEM$\$$ dir, so it's easily accessible, which then is launched from [GuiRunOnce], which in turn runs WPI.hta.I am attempting to have the VBS file read and parse "HKLM\Software\Microsoft\Setup\Sourcepath", but since it's a multiboot DVD, it's not just "d:\", it's "d:\setup\xp\pro". Therefore, I want the script to cut off the end, after the first 3 characters.My research suggests that the string.slice method should work, but it gives an error that "Object Required."My code is the following, so if anything might help to make this actually work, I'd appreciate it.Dim WshShell, testpath, key, fullpath, slicedkey="HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\Sourcepath"Set WshShell = WScript.CreateObject("WScript.Shell")testpath=WshShell.RegRead(key)sliced = testpath.slice(0,2)fullpath = sliced & "wpi\wpi.hta"WSHShell.Run fullpathI know this reads the reg key fine because my previous code used the path, hence my previous debugging. The following looks for the file in "d:\setup\xp\pro\wpi\wpi.hta" instead of the required "d:\wpi\wpi.hta"Dim WshShell, testpath, key, fullpath, slicedkey="HKLM\Software\Microsoft\Windows\CurrentVersion\Setup\Sourcepath"Set WshShell = WScript.CreateObject("WScript.Shell")testpath=WshShell.RegRead(key)fullpath = testpath & "wpi\wpi.hta"WSHShell.Run fullpathThanks in advance. Link to comment Share on other sites More sharing options...
Raja Posted October 17, 2004 Share Posted October 17, 2004 Changesliced = testpath.slice(0,2)Tosliced = Left(testpath,3)Slice is for JScripts. Link to comment Share on other sites More sharing options...
drmarvin Posted October 17, 2004 Author Share Posted October 17, 2004 Thanks so much, Raja, that was perfect, now I'm in business.Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now