The Basics
ARAP includes two versions of itself, a version with the Automation Interface enabled (the "AUTO" version) and one without (the "NO AUTO" version). The latter can be run multiple times to allow multiple scripts to run at the same time. ARAP is started from the icon on your desktop or from one of the two Windows programs menu items in the "Abbey Ridge Auto-Pilot" sub-menu.
ARAP scripts are written in plain-text (with each line ending with CR and LF characters) and as such can be created/edited in any text editor. Here are the basic syntax rules and other info:
- Script files use the file extension ‘dtl’ (Dave’s Telescope Language).
- There can be one command, variable assignment, or label per line.
- Commands are interpreted and executed in sequence, unless script execution flow changes by a Script Flow Control command.
- Each line consists of one or more parameters.
- The first parameter is the command name. The remaining parameters are arguments for the command. There can be no more than 50 parameters in total (including the command name).
- Parameters are separated by one or more spaces or tab characters. Enclose parameters that need to include spaces between double-quotes (").
- Indenting of lines with one or more spaces or tabs is fine.
- A line beginning with a semi-colon (;) is a comment line and is ignored. The rest of a line following a semi-colon is also a comment and is ignored (except if it is inside double-quotes). A line beginning with only spaces or tabs, then a semi-colon is also a comment and is ignored. Blank lines are also ignored.
- If a command (the first parameter) does not exist, ARAP attempts to run a sub-script named the same as the command - see the script command for more info. This is how subroutines (procedures in other languages) are implemented.
- A script can run itself (recursion).
- The maximum number of nested main and sub-scripts allowed is 20 after which a fatal error is generated.
- If a command ends with a colon (:), then it is interpreted as a label that can be "jumped" to by, for example, the jump command.
- If a parameter is preceded by a dollar-sign ($), it is interpreted as a variable or constant name and is converted to its value before the line is executed.
- If the first parameter ends with an equal sign (=), then it is to be interpreted as the shorthand for a set command - variable assignment. For example: "variable= hello" is the same as "set variable hello".
- Scripts can be made "pretty" by using one or more spaces or tabs to indent lines - these are ignored. In other words, commands or labels or variable assignments do not need at the beginning of lines.
- Command names, variables and constants, labels, etc. are not case-sensitive. The convention is to use lower case for commands and upper case for variables and labels.
- Command, variable and constant, and label names can conflict with one another with no ill effects.
- Syntax errors (non-existent commands, invalid command parameters, etc.) generate a fatal error and this means the script will abort. See Error Handling.
- Many telescope, dome, and focuser related commands execute a corresponding ASCOM command. For details about these commands, see the ASCOM documentation available in the Programs menu under "ASCOM Platform 6".
- Many imaging related commands execute a corresponding MaxIm DL/CCD scripting command. For details about these commands, see the MaxIm DL help file
- All right ascension and declination positions are Epoch J2000. Positions are precessed to and from the epoch required by the specific telescope.
- All calculations that depend on date and time assume that the computers clock is set to local time. Corrections to UTC time depend on the time zone and daylight savings time settings. There are also commands and variables to use a time other than present day. See the variable USESYSTEMTIME and the setdatetime and calcdatetime commands.
- Scripts can be started:
- from the command line using the following syntax: “arap scriptname.dtl parameter1 parameter2”. Up to 49 parameters can be included. When the script completes, ARAP terminates. The variable EXITCODE is returned to Windows.
- from the manual command line on the Tool Bar.
- by selecting "File -> Run Script..." from the menu.
- by an external program using ARAP's scripting interface.
- Scripts can be stopped by:
- the end command
- reaching the last line of the main script
- pressing the window close button (the X at the upper right corner of the ARAP main window) or the Exit tool bar button. In this case, ARAP requests that the current script terminate and it waits up to 60 seconds for it to do so. If it terminates ARAP itself closes, otherwise it doesn't.
- pressing the Pause Script tool bar button (and subsequently pressing the Abort button)
- When ARAP terminates, a special script called "shutdown.dtl" is run. It disconnects from all connected ASCOM drivers, MaxIm DL, and other sub-systems before ARAP finally exits.
- ARAP can be closed using the File->Exit item in the Menu, but only if a script is not running. ARAP will not exit if requested to do so by user if it is connected by the Automation Interface.