
Compiling error asking for ; already there?
<< I have written a 2 line jscript >>
When you switch from VBScript to JScript, several things happen:
1. You signal your intent to learn portable coding that has a future, and
2. Certain syntax requirements change. For example:
Return = WshShell.Run("c:\zips\raswin.exe",1,TRUE);
must instead be:
Return = WshShell.Run("c:\\zips\\raswin.exe",1,TRUE);
(among other things)
This is calles "escaping" a character, in this case you want to use the
special escape character '\' itself as a literal character. You may say
"this is more complicated!" -- you will continue to believe this until you
discover how easy it is to put anything in a JScript string, and how
difficult you will find it to put up with VBScript afterward.
Also -- avoid using words like "Return" as variable names. This word has a
meaning to the language and the habit will eventually get you into trouble,
even though this particular example won't.
Paul Lutus
Quote:
>Hi, can any help
>I have written a 2 line jscript based on an earlier posting by
>Jason Fox 'automate rasphone' code below. When I try to run it
>it says: Script Execution Error, Expected ';'
>However I have played around with putting ';' in and it still doesn't work.
>> Set WshShell = Wscript.CreateObject("Wscript.Shell");
>> Return = WshShell.Run("c:\zips\raswin.exe",1,TRUE);
>cheers
>Heather