The following script fails to run:
Run>C:\Windows\System32\wscript //B C:\ArmSys\AmiBroker\JS\test.js
On the other hand, double-clicking test.js runs successfully!
What's wrong with my MS script?
JavaScript
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Without researching I don't know about the wscript arguments but I would just do:
ExecuteFile>c:\ArmSys\AmiBroker\JS\test.js
ExecuteFile>c:\ArmSys\AmiBroker\JS\test.js
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- CyberCitizen
- Automation Wizard
- Posts: 724
- Joined: Sun Jun 20, 2004 7:06 am
- Location: Adelaide, South Australia
Hi CyberCitizen,CyberCitizen wrote:What about
Run>cmd /c wscript C:\ArmSys\AmiBroker\JS\test.js
Thanks for your help. Before posting my question, I have already attempted the following commands in vain. None works.
Run>C:\Windows\System32\wscript.exe C:\ArmSys\AmiBroker\JS\test.js
Run>C:\Windows\System32\cscript.exe C:\ArmSys\AmiBroker\JS\test.js
Run>cmd /C wscript c:\ArmSys\AmiBroker\JS\test.js
Run>cmd /nologo /C cscript C:\ArmSys\AmiBroker\JS\test.js
ExecuteFile>C:\ArmSys\AmiBroker\JS\test.js
On the other hand, double-click test.js, it runs brilliantly (in Windows Explorer). Or in the Cmd mode, type "test" and press enter. It works without any glitch.
However, I also discover a .bat file won't work either.
test.bat:
c:C:\ArmSys\AmiBroker\JS\test.js
So it may not be solely a Macro Scheduler problem.
After inserting some dummy message popup:
WshShell = new ActiveXObject( "WScript.Shell" );
WshShell.Popup ("NewA problem", 3,"Active X problem",0);
I found my JavaScript in question was in fact working. But some JS commands inside the JavaScript won't run when called by a Macro Scheduler script.
So, it is no longer a problem of Macro Scheduler.
Thanks for your help.
WshShell = new ActiveXObject( "WScript.Shell" );
WshShell.Popup ("NewA problem", 3,"Active X problem",0);
I found my JavaScript in question was in fact working. But some JS commands inside the JavaScript won't run when called by a Macro Scheduler script.
So, it is no longer a problem of Macro Scheduler.
Thanks for your help.
Eventually I discover the definitive solution after experimenting various scripts for the last 2 days. It turns out, by default, on the Win 7 x64 platform, the .js will trigger the 64-bit version of WScript.exe and it fails to run some, though not all, JavaScript commands.
The following command should save you many hours:
Run>%SYS_NATIVE%\WScript.exe C:\ArmSys\AmiBroker\JS\test.js
Thanks Marcus and CyberCitizen for your help.
Happy Chinese Year of the Snake!
The following command should save you many hours:
Run>%SYS_NATIVE%\WScript.exe C:\ArmSys\AmiBroker\JS\test.js
Thanks Marcus and CyberCitizen for your help.
Happy Chinese Year of the Snake!