Windows Forum / Windows XP / General Topics 1 / May 2008
VBS Scripts
|
|
Thread rating:  |
Geordie - 26 May 2008 20:38 GMT Hi, I am unable to run VBS Scripts,when I double click on them the following message appears. Line 1 char 18 Error Expected end of statement code 800A0401 source Microsoft VBScript compilation error. ------------------------------------- Windows XP home SP3 Any advice on how to fix this problem would be much appreciated.
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
Pegasus (MVP) - 26 May 2008 21:07 GMT > Hi, > I am unable to run VBS Scripts,when I double click on them the following [quoted text clipped - 7 lines] > Windows XP home SP3 > Any advice on how to fix this problem would be much appreciated. Let's have a look at your script!
Geordie - 27 May 2008 02:11 GMT >> Hi, >> I am unable to run VBS Scripts,when I double click on them the following [quoted text clipped - 9 lines] > > Let's have a look at your script! Thanks for the reply,
This is one of them.
Set IRP = getobject("winmgmts:\\.\root\default:Systemrestore") MYRP = IRP.createrestorepoint ("Quick Restore Point", 0, 100)
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
PaulM - 26 May 2008 22:42 GMT Can you post the script here?
 Signature ---------------------------------------- www.paulsxp.com www.paulsxp.com/forum ----------------------------------------
> Hi, > I am unable to run VBS Scripts,when I double click on them the following [quoted text clipped - 7 lines] > Windows XP home SP3 > Any advice on how to fix this problem would be much appreciated. Geordie - 27 May 2008 02:24 GMT > Can you post the script here? Hi,
This is another one downloaded from Doug Knox's site.
'Unattended System Restore Point 'sysrestorepoint.vbs '© Doug Knox - rev 02/11/2002 'Downloaded from www.dougknox.com 'Extracted from original code by Bill James - www.billsway.com
Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")
msg = "New Restore Point successfully created." & vbCR msg = msg & "It is listed as: " & vbCR msg = msg & "Automatic Restore Point " & Date & " " & Time
'Put a ' in front of the next five lines to disable the Success Failed Prompt. If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then MsgBox msg Else MsgBox "Restore Point creation Failed!" End If
'Remove the ' from the next 3 lines to only alert you if the process failed 'If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) <> 0 Then ' MsgBox "Restore Point creation Failed!" 'End If ------------------------------------------------- This is the error message for this one Script C:\downloads\xpsysrestorepoint. line 14 char 1 Error no such interface supported Code 80004002 Source SWbemObjectEX
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
PaulM - 27 May 2008 02:54 GMT Are you saying the script from Doug's site does not work?
 Signature ---------------------------------------- www.paulsxp.com www.paulsxp.com/forum ----------------------------------------
>> Can you post the script here? > [quoted text clipped - 35 lines] > Code 80004002 > Source SWbemObjectEX Geordie - 27 May 2008 04:31 GMT > Are you saying the script from Doug's site does not work? Hi, Yes,that is correct both scripts from Doug's site do not work.
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
PaulM - 27 May 2008 05:02 GMT You mean this script does not work:
WScript.Echo "Click Ok to Start Restore Point, this will take about 10 seconds." Set sr = getobject("winmgmts:\\.\root\default:Systemrestore") msg = "New Restore Point successfully created." & vbCR msg = msg & "It is listed as: " & vbCR msg = msg & "Automatic Restore Point " & Date & " " & Time
If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then MsgBox msg Else MsgBox "Restore Point creation Failed!" End If
Set sr = Nothing
 Signature ---------------------------------------- www.paulsxp.com www.paulsxp.com/forum ----------------------------------------
>> Are you saying the script from Doug's site does not work? > > Hi, > Yes,that is correct both scripts from Doug's site do not work. Geordie - 27 May 2008 05:10 GMT > You mean this script does not work: > [quoted text clipped - 12 lines] > > Set sr = Nothing That is correct, it does not work.
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
PaulM - 27 May 2008 05:17 GMT And what is the error?
>> You mean this script does not work: >> [quoted text clipped - 14 lines] > > That is correct, it does not work. Geordie - 27 May 2008 05:32 GMT > And what is the error? line 1 char 72 Error unterminated string constant code 800A0409 Source Micosoft VB Script compilation error
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
Pegasus (MVP) - 27 May 2008 06:07 GMT >> And what is the error? > line 1 > char 72 > Error unterminated string constant > code 800A0409 > Source Micosoft VB Script compilation error What happens when you run this code?
WScript.Echo "Click Ok to Start"
and this one:
WScript.Echo "Click Ok to Start" line = "winmgmts:\\.\root\default:Systemrestore" Set sr = GetObject(line) msg = "New Restore Point created." & vbCr msg = msg & "It is listed as: " & vbCr line = "Automatic Restore Point" If (sr.createrestorepoint("Line", 0, 100)) = 0 Then MsgBox msg Else MsgBox "Restore Point creation Failed!" End If
Geordie - 27 May 2008 20:37 GMT >>> And what is the error? >> line 1 [quoted text clipped - 20 lines] > MsgBox "Restore Point creation Failed!" > End If Hi, When the above is run, this is the error message that I get.
line 8 char 1 Error no such interface supported. Code 80004002 Source SWbemObjectEx
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
PaulM - 27 May 2008 21:11 GMT I do not know what you are doing wrong, but the script works for everyone else.
 Signature ---------------------------------------- www.paulsxp.com www.paulsxp.com/forum ----------------------------------------
>>>> And what is the error? >>> line 1 [quoted text clipped - 29 lines] > Code 80004002 > Source SWbemObjectEx Pegasus (MVP) - 27 May 2008 21:13 GMT As I said before, I can smell a rat. Let's try and nail this one down. Please follow the instructions below ***verbatim***, without deviating one bit! 1. Click Start / Run / cmd{OK} This will give you a black Command Prompt screen. 2. Type these commands: echo wscript.echo "Hello world" > c:\test.vbs{Enter} %SystemRoot%\system32\cscript.exe c:\test.vbs{Enter} 3. Report what you see on the screen.
Geordie - 27 May 2008 22:38 GMT > As I said before, I can smell a rat. Let's try and nail this one > down. Please follow the instructions below ***verbatim***, [quoted text clipped - 5 lines] > %SystemRoot%\system32\cscript.exe c:\test.vbs{Enter} > 3. Report what you see on the screen. Hi, Thanks for your help & patience. These are the results. Clicked Start..Run..typed cmd...OK Black screen appeared with this. C:\Documents and Setting\Maurice> I typed in. echo wscript.echo "Hello world" > c:\test.vbs then Enter The screen then went to. C:\Documents and Setting\Maurice> I then typed.%SystemRoot%\system32\cscript.exe c:\test.vbs then Enter Screen reported this Microsoft <R> Windows Script Host Version 5.6 copyright <C> Microsoft Corp 1996-2001 all rights reserved. Hello world C:\Documents and Setting\Maurice>
What started this thread, I had a restore.vbs file which I got off Doug's site,it has been on my PC for at least 2 years and has not been altered or even moved,it used to work on numerous occasions until I upgraded to SP3 then I started to get the error message.I copied the file and tested it on another PC the same as mine XP home SP3 and it worked fine. I only used to double click the file and it would work,I don't understand what I can be doing wrong with a simple double click. Thanks
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
Pegasus (MVP) - 27 May 2008 22:57 GMT >> As I said before, I can smell a rat. Let's try and nail this one >> down. Please follow the instructions below ***verbatim***, [quoted text clipped - 27 lines] > what I can be doing wrong with a simple double click. > Thanks The result of this test proves that in the previous tests you ran a script other than the one you thought you were running. You should now build up on this knowledge by doing the following: 1. Click Start / Run / cmd{OK} This will give you a black Command Prompt screen. 2. Type these commands: cd /d c:\Windows{Enter} notepad restore.vbs{Enter} {Paste the lines from Doug Knox's site into this file} {Save & close the file} %SystemRoot%\system32\cscript.exe c:\windows\restore.vbs{Enter} c:\windows\restore.vbs{Enter} 3. Report what you see on the screen. I expect the results from the last two commands to be the same.
Geordie - 28 May 2008 01:59 GMT >>> As I said before, I can smell a rat. Let's try and nail this one >>> down. Please follow the instructions below ***verbatim***, [quoted text clipped - 42 lines] > 3. Report what you see on the screen. I expect the results from the > last two commands to be the same. Hi, When I get to this part %SystemRoot%\system32\cscript.exe c:\windows\restore.vbs{Enter} I get this message on the screen Microsoft <R> windows scripthost Ver 5.6 copyright <C> Microsoft Corp 1996-2001 all rights reserved. c:\windows\restore.vbs <2, 17> SWbemObject:no such interface reported. Then after c:\windows\restore.vbs{Enter} A error messagae appears in a small blue box with the heading Windows Script Host line 2 char 1 Error No such interface supported Code 80004002 Source SWbemObjectEX
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
PaulM - 27 May 2008 07:09 GMT Line 1 does not have 72 chars in it? Did you edit the script in any way? Because it works on XP and Vista.
>> And what is the error? > line 1 > char 72 > Error unterminated string constant > code 800A0409 > Source Micosoft VB Script compilation error Pegasus (MVP) - 27 May 2008 07:13 GMT > Line 1 does not have 72 chars in it? > Did you edit the script in any way? > Because it works on XP and Vista. I have a strong suspicion that the OP is saving his script in one file and that he is executing a completly different file. This would explain all of his problems.
PaulM - 27 May 2008 07:19 GMT He is doing something wrong. I even redid some of the script and I tested it on XP and Vista and it works.
>> Line 1 does not have 72 chars in it? >> Did you edit the script in any way? [quoted text clipped - 3 lines] > script in one file and that he is executing a completly > different file. This would explain all of his problems. PaulM - 27 May 2008 07:21 GMT Here is the new one.
'Auto Restore Point for Vista set WshShell = CreateObject("WScript.Shell") Result = WshShell.Popup("System Restore will start in 5 seconds", 5, "AutoRestore", 65) Result = WshShell.Popup("It will take about 10 seconds to create the file." ,4, "Creating File",65) Set sr = getobject("winmgmts:\\.\root\default:Systemrestore") phm = "New Restore Point successfully created." & vbCR phm = phm & "It is listed as: " phm = phm & "Automatic Restore Point " & vbCR & Date & " " & Time
If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then MsgBox phm Else MsgBox "Restore Point creation Failed!" End If
Set sr = Nothing
>> Line 1 does not have 72 chars in it? >> Did you edit the script in any way? [quoted text clipped - 3 lines] > script in one file and that he is executing a completly > different file. This would explain all of his problems. Geordie - 27 May 2008 20:43 GMT > Here is the new one. > [quoted text clipped - 14 lines] > MsgBox "Restore Point creation Failed!" > End If Hi, Thanks for your help,when I try to use the above script,this is the error message that appears.
line 1 char 14 Error Expected end of statement code 800A0401 source microsoft VBScript compilation error
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
Pegasus (MVP) - 28 May 2008 13:00 GMT >> Here is the new one. >> [quoted text clipped - 25 lines] > code 800A0401 > source microsoft VBScript compilation error Sorry, your response is inherently contradictory. Line 1 of the code you show is a comment line, hence it cannot possible generate an error message.
Instead of trying to leap shortly after you have learnt to crawl, try to walk first. Here is how you can it it, using your own script as a starting point. 1. Click Start / Run / cmd{OK}. 2. Type this commands: cd /d c:\{Enter} notepad c:\test.vbs{Enter} {Click OK when prompted to create a new file} {copy & paste these 6 lines into your notepad session:} 'Auto Restore Point for Vista Set WshShell = CreateObject("WScript.Shell") WshShell.Popup "Restore will start in 5 seconds", _ 5, "AutoRestore", 65 WshShell.Popup "It will take 10 seconds" , 4, _ "Creating File",65 {Save & close the file} cscript c:\test.vbs{Enter} 3. Report the result
Geordie - 28 May 2008 20:32 GMT Hi, I tried this several times and after typing the final line, cscript c:\test.vbs{Enter} The small blue box which usually reports an error appeared with the option of restore will start in 5 seconds OK etc then seconds later restore will start in 10 seconds OK etc.
Regards, Geordie
> Sorry, your response is inherently contradictory. Line 1 of the code > you show is a comment line, hence it cannot possible generate an [quoted text clipped - 18 lines] > cscript c:\test.vbs{Enter} > 3. Report the result
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
Pegasus (MVP) - 28 May 2008 21:09 GMT > Hi, > I tried this several times and after typing the final line, cscript [quoted text clipped - 5 lines] > Regards, > Geordie This is what I expected. In other words, the first lines of your script finally do what they are supposed to do. You must have been off at some far flung corner of the universe when you ran your previous script.
Now continue with the method I outlined before but add one single line of code at a time to build up your confidence. I will show you the next version of the script:
'Auto Restore Point for Vista Set WshShell = CreateObject("WScript.Shell") WshShell.Popup "Restore will start in 5 seconds", _ 5, "AutoRestore", 65 WshShell.Popup "It will take 10 seconds" , 4, _ "Creating File",65 Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")
Please do not rush into this - take it nice and easy, one step at a time. When you fail, go back one step and try again.
Geordie - 29 May 2008 00:33 GMT OK, I have done that and the blue box pops up just like last time. Restore will start in 5 seconds OK cancel after a few seconds It will take 10 seconds.OK cancel
Regard, Geordie.
> This is what I expected. In other words, the first lines of your > script finally do what they are supposed to do. You must have [quoted text clipped - 16 lines] > step at a time. When you fail, go back one step and try > again.
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
Pegasus (MVP) - 29 May 2008 06:11 GMT > OK, I have done that and the blue box pops up just like last time. > Restore will start in 5 seconds OK cancel [quoted text clipped - 3 lines] > Regard, > Geordie. Good. Now as I said, keep adding lines until you have the whole script together. You should then spend some time thinking about what you're doing differently now compared to before so that you get to understand why your script failed so persistently on all previous occasions.
Geordie - 29 May 2008 21:55 GMT > Good. Now as I said, keep adding lines until you have the > whole script together. You should then spend some time > thinking about what you're doing differently now compared > to before so that you get to understand why your script failed > so persistently on all previous occasions. I tried this approx 10 times yesterday and several times today,it works OK until I type or copy & paste the following lines as instructed. ---------------------------------------------------- If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then MsgBox phm This single line when added brings up the blue box with an error message Script C:\Test.vbs Line 12 char 15 Error expected "end" Code 800A03f6 Source Microsoft VBScript compilation error ----------------------------------------------------- Else MsgBox "Restore Point creation Failed!" End If ---------------------------------------------------- When both lines are added, the error box after going through the 5 & 10 second routine brings up this. Script C:\Test.vbs Line 11 char 1 Error No such interface supported Code 80004002 Source SWbemObjectEx
I have copied this file,test.vbs & tried it on 2 other PCs XP (Home SP3) and it worked fine on both of them. I believe that this exercise has finally proven that there is a fault on the OS of this PC & not my typing or double clicking on files which have been compiled by Doug Knox or Kelly etc with instructions to download,then double click and do not work on mine but are OK on other PCs. As PaulM stated, he doesn't know what I am doing wrong because they work fine on everyone else's PC, this is what I could not understand from the start of this thread and is why I originally asked for help. I really don't know what else to try.
 Signature Regards, Geordie. Please remove (Prop) to crash spam.
Pegasus (MVP) - 29 May 2008 22:10 GMT >> Good. Now as I said, keep adding lines until you have the >> whole script together. You should then spend some time [quoted text clipped - 38 lines] > start of this thread and is why I originally asked for help. > I really don't know what else to try. If I was in your situation then I would try the script on some other machine. There are two possible outcomes: a) If it works there then there is something wrong with your PC. You may have to reload Windows from scratch. b) If it does not work there then there is something wrong with the way you're doing things. Get someone who knows about programming to look over your shoulder while you're creating and running this code. There is a third option, which I do not recommend: Open up your PC for remote access so that I can see for myself what's going on. Drop me a line on pegasus_fnlATyahooDOTcom if you wish to consider this option. Other than this I will now stop monitoring this thread.
|
|
|