October 17, 200421 yr 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.
October 17, 200421 yr Changesliced = testpath.slice(0,2)Tosliced = Left(testpath,3)Slice is for JScripts.
Create an account or sign in to comment