-
1. Re: How to pass variable from JSX to VBS
Harbs. Mar 18, 2011 5:26 AM (in response to Skempy)Don't pass it.
Save it as an environment variable or save the variable to a file.
Harbs
-
2. Re: How to pass variable from JSX to VBS
Mayhem SWE Mar 18, 2011 5:42 AM (in response to Skempy)I'm pretty sure your VBScript will only be passed the value of the myEvent variable, not the variable itself. For this reason you will not be able to access the variable by name. There may be a better way but in JavaScript the easiest way is probably to access the arguments through the appropriately named property arguments (an array). Possibly something similar is available in VBScript as well?
I am kinda doubtful you'll be able to pass JavaScript objects as arguments to a VBScript though. Since it seems like what you're after is just the active document, is probably safer to just pass the id or index (as a number) of the document rather than an object reference to the document.
-
3. Re: How to pass variable from JSX to VBS
Skempy Mar 18, 2011 5:48 AM (in response to Harbs.)Thanks Harbs,
I had thought of writing a file but environment variable sound interesting.
Are we talking about something like...
$.setenv("myVariable","Hello World")
alert($.getenv("myVariable"))
Any idea how to retrieve an environment variable in vbs?
-
4. Re: How to pass variable from JSX to VBS
Skempy Mar 18, 2011 5:58 AM (in response to Skempy)This seems to work in vbs...
Set WshShell = CreateObject("WScript.Shell")
Set objEnv = WshShell.Environment("Process")
msgbox objEnv("myVariable")Thanks for your assistance.
Simon.
-
5. Re: How to pass variable from JSX to VBS
Olav Martin Kvern Mar 18, 2011 12:18 PM (in response to Skempy)Hi Skempy,
Like this:
myVariable = ["Hello World"];
myScript = "c:/test.vbs";
app.doScript(myScript, ScriptLanguage.visualBasic,myVariable);rem test.vbs script
msgbox arguments(0)
Thanks,
Ole



