Extend Script offers command line access on Windows and Mac OS X.
Issue
Can I access the Window's command line from my Extend Script?
Solution
There is a previously undocumented function:
system( "commandLineStuff" );
This function calls the command line on Windows and the Shell on Mac OS X. It doesn't work on Mac OS 9 since there's no Shell or command line.
To create a binary you can use any compiler which creates a dll for Windows or a CFM library for OS X. You can't call a Mach-O library on OS X. (That would be possible if you wrote a little bridge from CFM to Mac-O.)
Windows Examples
You can enter the code below into the "command" line of the GoLive JavaScript shell window. The resulting file will be found in the directory represented by app.currentFolder. By default on Windows, this is the folder where GoLive is installed.
system("dir > dirList.txt")
You can change app.currentFolder to another folder using the File Object Constructor.
app.currentFolder = JSXFile("file://C:/Program Files/Adobe/FrameMaker7.0/")
You can then launch an application in that folder with:
system("framemaker.exe")
Note: Golive will be locked up as long as the Command Prompt window is open. You'll have to close the Command Prompt window manually.
Mac OS X Example
On OSX if you don't specify directories, the directory being listed is the root directory and the generated file will be found at root.
system("ls > list.txt")
You can select other existing directories using:
system("ls /etc > /tmp/list.txt")
To launch a CFM application use:
system("open -a '/Applications/Acrobat Reader 5.0'")
To launch bundled applications use:
system("open -a '/Applications/Chess.app'")
(Use Show Info > Name & Extension, or a Terminal window to see if the File System Name includes a ".app" extension.)
Result
The return value is always the return value of the executed command.
result = 0 typically indicates success.