User Tools

Site Tools


Sidebar

Home

Documentation

Tutorial

Reference Manual

Installation

en:documentation:script_reference

Pascal script reference

This page contain reference material for scripting functions using the Pascal language. Beware Pascal script are not supported on ARM processor. Refer to this page if you want to use the Python language.

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.


Retrieve script parameters

namevalue
ParamCountthe number of parameters available
ParamStrarray of string containing the parameters. ParamStr[0] is always the script filename

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
CoverStatusThe status of the telescope cover
CalibratorStatusThe status of the flat calibrator
LastErrorThe text of the last error
HostOSThe operating system on the computer running CCDciel
DirectorySeparatorThe directory separator symbol on the computer running CCDciel
AppDirThe directory where the program is installed
TmpDirThe directory for temporary files
CaptureDirThe directory to save the images from capture sequence
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
FocuserPosition The focuser absolute position
CalibratorBrightnessThe brightness of the calibrator
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
OBS_LATITUDEThe observer latitude
OBS_LONGITUDEThe observer longitude
OBS_ELEVATIONThe observer elevation
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_TRACKING True if the telescope is tracking
TELESCOPE_SLEWING True if the telescope is slewing
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


function GetV(varname:string; var v: Variant):Boolean;
Get the ASCOM interface for the device identified by varname (Windows only)
varnamevalue
TELESCOPE, DOME, CAMERA, GUIDERCAMERA, FINDERCAMERA, FOCUSER, FILTER, ROTATOR, COVER, SAFETY, WEATHER The corresponding ASCOM device connected to CCDciel
Variant1 .. Variant10Ten global variable for your use


function SetV(varname:string; v: Variant):Boolean;
Set the global variant variable identified by varname for later use
varnamevalue
Variant1 .. Variant10Ten global variable for your use



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
AUTOGUIDER_GETLOCKPOSITION Return the current guide lock position
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
FINDER_STOPLOOP Stop the finder loop
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
ASTROMETRY_PLOT_DSO Plate solve the current image and annotate DSO
ASTROMETRY_PLOT_HYPERLEDA Plate solve the current image and annotate DSO using the hyperleda catalog
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
COVER_OPEN Open the telescope cover
COVER_CLOSE Close the telescope cover
CALIBRATOR_LIGHT_OFF Turn flat calibrator light off
CUSTOMHEADER_CLEAR Delete all the custom header keywords


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, do not return until the slew is complete
TELESCOPE_SLEWASYNC RA, DEC Slew to specified coordinates, return immediatelly
TELESCOPE_SYNC RA, DEC Sync to specified coordinates
TELESCOPE_PARK ON/OFFPark or unpark the telescope
AUTOGUIDER_SETLOCKPOSITION x,y Set immediately the new guide lock position in PHD2 or Internal guider
AUTOGUIDER_STORELOCKPOSITION x,y Store the guide lock position for the next time guiding is started
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
FOCUSER_SETPOSITION number Set the focuser absolute position
SetFocusXY X,Y Select the star at position X,Y for focus operation
Get_Switch nickname,switchname Return the current value for the switch
Set_Switch nickname,switchname,value Set the value of the switch
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
FINDER_SAVEIMAGES ON/OFF Activate the saving of finder image when looping
FINDER_STARTLOOP exposure time Start the finder loop with the given exposure time
Finder_Snapshot exposure time, filename, count Take a series of finder snapshot
Internalguider_Snapshot exposure time, filename, count Take a series of guide camera snapshot, guiding must be stopped before to use this command
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
PLANETARIUM_SHOWIMAGE_FOV FOV [degree] Plate solve the current image and show in planetarium using the specified field of view
CALIBRATOR_LIGHT_ON brightness Light the flat calibrator at the specified brightness
CUSTOMHEADER_ADD key, value Add a new custom header keyword with value. Replace the value if the key already exist
CUSTOMHEADER_DEL key Delete all the occurrence of this custom header keyword
CUSTOMHEADER key Return the value for this keyword

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. RA in hours, all other angle in degree


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. RA in hours, all other angle in degree

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.txt · Last modified: 2024/03/17 17:25 by pch