Error using 'run' Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
madsounds
Posts: 59
Joined: 31 May 2019, 08:14

Error using 'run'

31 May 2019, 08:27

Hey there! When I start my main.ahk, it gives an error message. The main.ahk is just launching a Windows Script Control (WSH) script, the code is:

Code: Select all

RunWait C:\Windows\System32\WScript.exe D:\Downloads\create_script_control_obj.js
Error message displays this:
Script: D:\Downloads\create_script_control_obj.js
Line: 1
Char: 1
Error: Automation server can't create object
Code: 800A01AD
Source: Microsoft JScript runtime error[/code]


But when I'm launching JS-file itself, not from AHK, it works fine, what could be the reason?

In js code, there's just a creation of new ScriptControl object:

Code: Select all

var  vbe = new ActiveXObject( 'ScriptControl' );
WScript.Echo( 'ok' );
Mod edit: Title fix
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: Error using 'run'  Topic is solved

31 May 2019, 09:39

I got the same error by double clicking the js file, but works fine from AHK with either of the code:
  • RunWait C:\Windows\System32\WScript.exe D:\Downloads\create_script_control_obj.js
  • RunWait D:\Downloads\create_script_control_obj.js
Then I opened Task Manager, and found the reason of it:
  • The working one was launched by C:\Windows\SysWOW64\wscript.exe
  • The failure one was launched by C:\Windows\System32\wscript.exe
So you could try:

Code: Select all

RunWait C:\Windows\SysWOW64\wscript.exe D:\Downloads\create_script_control_obj.js
madsounds
Posts: 59
Joined: 31 May 2019, 08:14

Re: Error using 'run'

01 Jun 2019, 04:36

tmplinshi wrote:
31 May 2019, 09:39
So you could try:

Code: Select all

RunWait C:\Windows\SysWOW64\wscript.exe D:\Downloads\create_script_control_obj.js
Yes, it works! Thank you very much! You saved my 1500 lines scripts :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], JKJadan, peter_ahk and 294 guests