CAS can be started from a command line and a script can be automatically ran.
Sample command path to start CAS: (Adjust file paths for the environment.)
"C:\Program Files (x86)\CarlisleGroup\CAS 5.0\dyalogrt.exe" "C:\Program Files (x86)\CarlisleGroup\CAS 5.0\CAS.dws" inifile="HKEY_LOCAL_MACHINE\Software\CarlisleGroup\CAS 5.0"
You must add the following 2 parameters to open a file and run a script.
open=”path to the file”
script=”unique name of script to start”
For example:
"C:\Program Files (x86)\CarlisleGroup\CAS 5.0\dyalogrt.exe" "C:\Program Files (x86)\CarlisleGroup\CAS 5.0\CAS.dws" inifile="HKEY_LOCAL_MACHINE\Software\CarlisleGroup\CAS 5.0" open="C:\Program Files (x86)\CarlisleGroup\CAS 5.0\Files\Samples\sample 50.cas" script="Portfolio Summary"
Custom Parameters:
CAS scripts can read command line parameters. You simply need to add your parameter=value pairs to the command line. Once CAS is running, you can use the CasSession.GetCommandLineParameter2 method to return a CharString object.
For example:
"C:\Program Files (x86)\CarlisleGroup\CAS 5.0\dyalogrt.exe" "C:\Program Files (x86)\CarlisleGroup\CAS 5.0\CAS.dws" inifile="HKEY_LOCAL_MACHINE\Software\CarlisleGroup\CAS 5.0" open="C:\Program Files (x86)\CarlisleGroup\CAS 5.0\Files\Samples\sample 50.cas" script="Portfolio Summary" MYPARAM1="VALUE1" MYPARAM2="VALUE2"
P1 ← CasSession.GetCommandLineParameter2 'MYPARAM1'
P2 ← CasSession.GetCommandLineParameter2 'MYPARAM2'
P2.Show 'My Parameter Value'
Note 1
CAS cannot pass results back to the command. Text files can be used for logging and status flags. Also, if a file is opened by another user, CAS will show a message box asking if you want to open in read-only mode. To avoid this, set automation script files to "Read-Only" in the Windows file properties. This is a good idea since it is bad form to overwrite a master script file.
How to set a file to read-only.
Note 2
When defining parameters, make sure there are no blank between the parameter the equal sign and the beginning of the value.
Good : file="c:\test\test.cas"
Bad: file ="C:\test\test.cas"