Hello,
With ExtendScript I'm attempting to pass arguments to a VBS script from inside of a JSX script. I see that the arguments can be passed but I'm not sure how to retrieve those from inside of the VBS shell.
This is the example from AppleScript on OSX to read some text from a file using the cat command.
// establish array
ARG = [];
// establish variable
pathARG = "/path/to/file";
// push variable into array
ARG.push( pathARG );
// create AppleScript
var readTextScript = 'set filePath to item 1 of arguments\r'
readTextScript += 'do shell script "cat " & filePath';
// execute script with arguments
myResult = app.doScript( readTextScript, ScriptLanguage.APPLESCRIPT_LANGUAGE, ARG );
And here's an attempt to do the same with VBS script using the ReadAll command which fails.
// create VBS script
var readTextScript = 'Set wshShell = CreateObject( "WScript.Shell" )\r' +
'Set filePath = wshShell.Arguments.Item(0)\r' +
'Set objFileToRead = CreateObject("Scripting.FileSystemObject").OpenTextFile(filePath,1)\r' +
'strFileText = objFileToRead.ReadAll()\r' +
'objFileToRead.Close\r' +
'returnValue = strFileText';
var myResult = app.doScript( readTextScript,ScriptLanguage.VISUAL_BASIC, ARG );
Error message: "Object doesn't support this property of method: 'wshShell.Arguments'
Any help would be appreciated!
--
Jared Annear