User Tools

Site Tools


Sidebar

Home

Documentation

Tutorial

Reference Manual

Installation

en:documentation:script_reference

This is an old revision of the document!


Script reference

This page contain reference material for scripting functions.

See the script description page for general information.

See the script example page for a quick start with the programming functions.

Script language

The language to use is Pascal Script.
For a complete reference of the Object Pascal language your can read the Free Pascal Reference guide. But beware that some feature are not implemented by the script language, for example: no pointer, no assembler, no overloading.

In addition to the standard Pascal Script feature the following CCDciel specific function are added.


Constants

namevalue
deg2rad degree to radian conversion constant
rad2deg radian to degree conversion constant
msgOK returned when a CCDciel command complete successfully
msgFailedreturned when a CCDciel command fail

Global variables access

function GetS(varname:string; var str: string):Boolean;
Get the global string variable identified by varname
varnamevalue
LASTERRORThe text of the last error
Str1 .. Str10Ten global variable for your use


function SetS(varname:string; str: string):Boolean;
Set the global string variable identified by varname for later use
varnamevalue
Str1 .. Str10Ten global variable for your use


function GetSL(varname:string; var strl: Tstringlist):Boolean;
Get the global stringlist variable identified by varname
varnamevalue
Strl1 .. Strl10Ten global variable for your use


function SetSL(varname:string; stlr: Tstringlist):Boolean;
Set the global stringlist variable identified by varname for later use
varnamevalue
Strl1 .. Strl10Ten global variable for your use


function GetI(varname:string; var i: Integer):Boolean;
Get the global integer variable identified by varname
varnamevalue
Int1 .. Int10Ten global variable for your use


function SetI(varname:string; i: Integer):Boolean;
Set the global integer variable identified by varname for later use
varnamevalue
Int1 .. Int10Ten global variable for your use


function GetD(varname:string; var x: double):boolean;
Get the global double variable identified by varname
varnamevalue
TelescopeRAThe telescope position right ascension
TelescopeDEThe telescope position declination
TimeNowThe current time in TDateTime format
CCDTEMPThe current CCD temperature
Double1 .. Double10Ten global variable for your use


function SetD(varname:string; x: Double):Boolean;
Set the global double variable identified by varname for later use
varnamevalue
Double1 .. Double10Ten global variable for your use


function GetB(varname:string; var x: boolean):boolean;
Get the global boolean variable identified by varname
varnamevalue
TELESCOPE_CONNECTED True if the telescope is connected
TELESCOPE_PARKED True if the telescope is parked
TELESCOPE_EQMOD True if the telescope use the EqMod driver
AUTOGUIDER_CONNECTED True if the auto-guider is connected
AUTOGUIDER_RUNNING True if the auto-guider is running
AUTOGUIDER_GUIDING True if the auto-guider is guiding
WHEEL_CONNECTED True if the filter wheel is connected
FOCUSER_CONNECTED True if the focuser is connected
CAMERA_CONNECTED True if the camera is connected
PLANETARIUM_CONNECTED True if the planetarium is connected
PREVIEW_RUNNING True if the preview is running
PREVIEW_LOOP True if the preview is in loop
CAPTURE_RUNNING True if a capture is running

Commands

function Cmd(cname:string):string;
Execute a simple command cname in CCDciel.

Valid Cmd() command are:

CommandDescription
TELESCOPE_ABORTMOTION Stop any telescope movement
TELESCOPE_TRACK Start telescope tracking
EQMOD_CLEARPOINTS Clear EqMod alignment data
EQMOD_CLEARSYNCDELTA Clear Eqmod sync delta
EQMOD_STDSYNC Set Eqmod in Standard sync mode
EQMOD_APPENDSYNC Set Eqmod in Add point on sync mode
AUTOGUIDER_CONNECT Connect to the autoguider software
AUTOGUIDER_CALIBRATE Force a new calibration of the autoguider
AUTOGUIDER_STARTGUIDING Start to guide
AUTOGUIDER_STOPGUIDING Stop guiding
AUTOGUIDER_PAUSE Pause guiding
AUTOGUIDER_UNPAUSE Restart after pause
AUTOGUIDER_DITHER Dither now
AUTOGUIDER_SHUTDOWN Close the autoguider program
WHEEL_GETFILTER Get the current filter number in the wheel
PREVIEW_SINGLE Start a single preview
PREVIEW_LOOP Start a preview loop
PREVIEW_WAITLOOP Wait until the user stop the preview loop
PREVIEW_STOP Stop any in progress preview or preview loop
CAPTURE_START Start a capture
CAPTURE_STOP Stop a capture
ASTROMETRY_SOLVE Plate solve the current image
ASTROMETRY_SYNC Plate solve the current image and sync the telescope
ASTROMETRY_SLEW_IMAGE_CENTER Plate solve the current image and slew the telescope
PLANETARIUM_CONNECT Connect the planetarium software
PLANETARIUM_SHOWIMAGE Plate solve the current image and show in planetarium
PLANETARIUM_SHUTDOWN Close the planetarium software
PROGRAM_SHUTDOWN Close CCDciel
CLEAR_REFERENCE_IMAGE Remove the reference image
AUTOFOCUS Run auto-focus at the current position
AUTOMATICAUTOFOCUS Move to a bright star and run auto-focus, return to last position when finished


function CmdArg(cname:string; arg:Tstringlist):string;
Execute a command cname in CCDciel with parameters arg. Add each parameter to the string list.

Valid CmdArg() command are:

CommandArgumentsDescription
DEVICES_CONNECTION ON/OFF Connect or disconnect the devices
TELESCOPE_SLEW RA, DEC Slew to specified coordinates
TELESCOPE_SYNC RA, DEC Sync to specified coordinates
TELESCOPE_PARK ON/OFFPark or unpark the telescope
WHEEL_SETFILTER number Set the filter number in the wheel
WHEEL_GETFILTERSNAME arg On return arg contain the name of the filters
WHEEL_SETFILTERSNAME arg Put each filter name in arg
CCD_SETTEMPERATURE temp Set the CCD temperature
PREVIEW_SETEXPOSURE exp Set the preview exposure time
PREVIEW_SETBINNING bin Set the preview binning
CAPTURE_SETEXPOSURE exp Set the capture exposure
CAPTURE_SETBINNING bin Set the capture binning
CAPTURE_SETOBJECTNAME name Set the capture object name
CAPTURE_SETCOUNT count Set the capture image count
CAPTURE_SETFRAMETYPE Light/Bias/Dark/Flat Set the capture frame type
CAPTURE_SETDITHER count Set the capture Dither count
SEQUENCE_START sequence Load and start the sequence
SAVE_FITS_FILE filename Save the FITS file
OPEN_FITS_FILE filename Open the FITS file
OPEN_REFERENCE_IMAGE filename Load a reference image

Delay functions

procedure Wait(wt:integer);
Wait wt seconds before to continue the execution


function WaitTill(hour:string; showdialog: boolean):boolean;
Wait until the time is “hour”, encoded as 23:30:00 .
If the time is already passed by less than 12h the function return immediately, if it is passed for more than 12h it wait for the next day.
If showdialog is true a dialog with time countdown is show, this dialog also allow to cancel or to continue immediately, it return False if the wait is canceled.

Coordinates conversion

Procedure Eq2Hz(var ra,de : double ; var a,h : double);
Convert Equatorial ra,de to Alt/Az a,h for the location and time of the current chart, all angle in radian


Procedure Hz2Eq(var a,h : double; var ra,de : double);
Convert Alt/Az a,h to equatorial ra,de for the location and time of the current chart, all angle in radian

Formating and conversion

Function ARtoStr(var ar: Double) : string;
Return a string formated Right Ascension of ar value


Function DEtoStr(var de: Double) : string;
Return a string formated Declination of de value


Function StrtoAR(str:string; var ar: Double) : boolean;
Convert a formated string to Right Ascension decimal value


Function StrtoDE(str:string; var de: Double) : boolean;
Convert a formated string to Declination decimal value


Function JDtoStr(var jd: Double) : string;
Format a julian date to YYYY-MM-DD string


Function StrtoJD(dt:string; var jdt: Double) : boolean;
Convert a formated string YYYY-MM-DD to julian date value


Function FormatFloat(Const Format : String; var Value : double) : String;
Format a decimal number according to the Format specification


Function Format(Const Fmt : String; const Args : Array of const) : String;
The Format Pascal function


Procedure StrtoFloatD(str:string; var defval: Double; var val: Double);
Convert a string to a floating point value. Return defval if the string is a invalid number


function IsNumber(str: String): boolean;
Return True if the string represent a valid number


function StringReplace(str,s1,s2: String): string;
Replace all occurrence of s1 by s2 in str

Dialog

function MsgBox(const aMsg: string):boolean;
A message confirmation dialog. Return True if YES is clicked.


Procedure ShowMessage(const aMsg: string);
Display a message.


Procedure LogMsg(const aMsg: string);
Write a message to the log

Run external program

function Run(cmdline:string):boolean;
Execute the specified command. Return immediately without waiting for the execution to end.


function RunWait(cmdline:string):boolean;
Execute the specified command. Wait for termination.


function RunOutput(cmdline:string; var output:TStringlist):boolean;
Execute the specified command, wait for termination and put the stdout to “output”. Beware this function can completely lock the main program if it not finish in time.


function OpenFile(fn:string):boolean;
Open a document file using the default program



en/documentation/script_reference.1503861695.txt.gz · Last modified: 2017/08/27 21:21 by pch