amibroker

HomeKnowledge Base

Running OLE automation scripts with 32- and 64-bit versions of AmiBroker

Automation scripts written in JScript or VBScript are supposed to be run from Windows Explorer to control AmiBroker from outside and run certain predefined tasks specified in the script. The recommended documentation explaining the automation interface and AmiBroker object model is presented here:
http://www.amibroker.com/guide/objects.html
http://www.amibroker.com/newsletter/01-2000.html

In case of any problems with execution of automation scripts, the very first thing to check is the .js (JScript) or .vbs (VBScript) file association within the Windows Control Panel. This determines which program in Windows executes the files with .js extension. By default that should be Windows Scripting Host, which is the default scripting engine integrated into Windows.

The following Microsoft help resources show how to change the file associations:
http://windows.microsoft.com/en-us/windows/change-default-programs#1TC=windows-7
http://windows.microsoft.com/en-us/windows-8/choose-programs-windows-uses-default

The other thing to remember is the fact that in 64-bit Windows there are actually two JavaScript engines, 32- and 64-bit. The location of those programs are:

32-bitC:\Windows\SysWOW64\CScript.exe64-bitC:\Windows\System32\CScript.exe

If only one AmiBroker version installed, Windows would launch this installed version regardless of which scripting engine was used.

Things look differently if you installed both 32-bit and 64-bit versions of AmiBroker on the very same machine. In this case 32-bit scripting engine would open 32-bit AmiBroker while 64-bit scripting engine would open 64-bit AmiBroker.Therefore, if we want to specifically launch 32-bit AmiBroker, then pointing at the particular engine by using command line may be required:

C:\Windows\SysWOW64\CScript.exe Filename.js

(this one is for 32-bit version, the path names are in fact quite confusing, since Microsoft uses System32 folder for 64-bit programs in a 64-bit system).

Comments are closed.