en:documentation:script_reference
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:documentation:script_reference [2014/06/15 15:27] – created pch | en:documentation:script_reference [2017/02/22 11:19] (current) – [Formating and conversion] pch | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| The language to use is [[wp> | The language to use is [[wp> | ||
| - | For a complete reference of the Object Pascal language your can read the [[http:// | + | For a complete reference of the Object Pascal language your can read the [[http:// |
| In addition to the standard Pascal Script feature the following Skychart specific function are added. | In addition to the standard Pascal Script feature the following Skychart specific function are added. | ||
| + | ===== Main menu function ===== | ||
| + | |||
| + | Every items of the main menu can be used from the scripts.\\ | ||
| + | The full list of menu items name is available from the [[http:// | ||
| + | |||
| + | You can execute the menu action by using the Click method, or test if an option is activated by testing the Checked property. | ||
| + | |||
| + | ===== Translation string ===== | ||
| + | |||
| + | Every string translated for the main program can be used in a script.\\ | ||
| + | Directly use the rsXXX constant to get the translated string.\\ | ||
| + | The full list of available string is available from the [[http:// | ||
| + | If a string is not translated for your language don't hesitate [[: | ||
| + | |||
| + | ===== Constants ===== | ||
| + | |||
| + | ^name^value^ | ||
| + | |deg2rad| degree to radian conversion constant| | ||
| + | |rad2deg| radian to degree conversion constant| | ||
| ===== Global variables access ===== | ===== Global variables access ===== | ||
| Line 30: | Line 49: | ||
| ^varname^value^ | ^varname^value^ | ||
| |Str1 .. Str10|Ten global variable for your use| | |Str1 .. Str10|Ten global variable for your use| | ||
| + | |||
| + | ^function GetSL(varname: | ||
| + | |Get the global stringlist variable identified by varname|| | ||
| + | ^varname^value^ | ||
| + | |Strl1 .. Strl10|Ten global variable for your use| | ||
| + | |||
| + | ^function SetSL(varname: | ||
| + | |Set the global stringlist variable identified by varname for later use|| | ||
| + | ^varname^value^ | ||
| + | |Strl1 .. Strl10|Ten global variable for your use| | ||
| ^function GetI(varname: | ^function GetI(varname: | ||
| Line 78: | Line 107: | ||
| |Rotator1 , Rotator2|Two ASCOM Rotator objects| | |Rotator1 , Rotator2|Two ASCOM Rotator objects| | ||
| |Variant1 .. Variant10|Ten global variable for your use| | |Variant1 .. Variant10|Ten global variable for your use| | ||
| + | |||
| + | ===== Chart and Celestial objects ===== | ||
| + | |||
| + | ^function | ||
| + | |Execute one of the [[server_commands|Skychart server]] command. Add the command name first to the string list, then each parameter. | | ||
| + | |||
| + | ^procedure SendInfo(origin, | ||
| + | |Send a message to the clients connected to the [[server_commands|Skychart server]].| | ||
| + | |||
| + | ^function GetObservatoryList(list: | ||
| + | |Return the list of the Observatory favorite| | ||
| + | |||
| + | ^function GetScopeRates(list: | ||
| + | |Return a list of speed rate supported by the telescope| | ||
| + | |||
| + | ^function GetCometList(const filter: string; maxnum: | ||
| + | |Return a list of comet according to the filter| | ||
| + | |||
| + | ^function GetAsteroidList(const filter: string; maxnum: | ||
| + | |Return a list of asteroid according to the filter| | ||
| + | |||
| + | ^function CometMark(list: | ||
| + | |Mark the listed comet to the chart| | ||
| + | |||
| + | ^function AsteroidMark(list: | ||
| + | |Mark the listed asteroid to the chart| | ||
| + | |||
| + | |||
| + | ===== 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| | ||
| + | |||
| + | ^Procedure Eq2Gal(var ra,de : double ; var l,b : double);^ | ||
| + | |Convert Equatorial ra,de to Galactic l,b , all angle in radian| | ||
| + | |||
| + | ^Procedure Gal2Eq(var l,b : double; var ra,de : double);^ | ||
| + | |Convert Galactic l,b to equatorial ra,de , all angle in radian| | ||
| + | |||
| + | ^Procedure Eq2Ecl(var ra,de : double ; var l,b : double);^ | ||
| + | |Convert Equatorial ra,de to Ecliptic l,b with obliquity for the date of the current chart, all angle in radian | | ||
| + | |||
| + | ^Procedure Ecl2Eq(var l,b : double; var ra,de : double);^ | ||
| + | |Convert Ecliptic l,b to Equatorial ra,de with obliquity for the date of the current chart, all angle in radian| | ||
| + | |||
| + | |||
| ===== Formating and conversion ===== | ===== Formating and conversion ===== | ||
| Line 104: | Line 182: | ||
| ^Function Format(Const Fmt : String; const Args : Array of const) : String;^ | ^Function Format(Const Fmt : String; const Args : Array of const) : String;^ | ||
| |The [[http:// | |The [[http:// | ||
| + | |||
| + | ^Procedure StrtoFloatD(str: | ||
| + | |Convert a string to a floating point value. Return defval if the string is a invalid number | | ||
| ^function IsNumber(str: | ^function IsNumber(str: | ||
| |Return True if the string represent a valid number| | |Return True if the string represent a valid number| | ||
| + | |||
| + | ^function StringReplace(str, | ||
| + | |Replace all occurrence of s1 by s2 in str| | ||
| + | |||
| + | ^procedure JsonToStringlist(jsontxt: | ||
| + | |Parse a JSON formated string and return two stringlist. SK contain the names and SV the corresponding values| | ||
| + | |||
| + | |||
| ===== Dialog ===== | ===== Dialog ===== | ||
| Line 118: | Line 207: | ||
| ^function MsgBox(const aMsg: string): | ^function MsgBox(const aMsg: string): | ||
| |A message confirmation dialog. Return True if YES is clicked.| | |A message confirmation dialog. Return True if YES is clicked.| | ||
| + | |||
| + | ^Procedure ShowMessage(const aMsg: string);^ | ||
| + | |Display a message.| | ||
| ^function CalendarDialog(var dt: double): boolean;^ | ^function CalendarDialog(var dt: double): boolean;^ | ||
| |The Skychart Calendar dialog. Return dt julian date| | |The Skychart Calendar dialog. Return dt julian date| | ||
| - | ===== Chart and Celestial objects | + | ===== Run external program ===== |
| + | |||
| + | ^function Run(cmdline: | ||
| + | |Execute the specified command. Return immediately without waiting for the execution to end.| | ||
| + | |||
| + | ^function RunOutput(cmdline: | ||
| + | |Execute the specified command, wait for termination | ||
| + | |||
| + | ^function OpenFile(fn: | ||
| + | |Open a document file using the default program| | ||
| + | |||
| + | Also see the [[script_example|example]] about how to call a function in an external library. | ||
| + | |||
| + | ===== TCP/IP client socket ===== | ||
| + | |||
| + | For all this functions **socknum** identify the socket to use. This is a number between 1 and 10, thus allowing 10 simultaneous connection to different server. | ||
| + | |||
| + | ^function TcpConnect(socknum: | ||
| + | |Connect to the server at ipaddr:port and set the **timeout** for the subsequent operations| | ||
| + | |||
| + | ^function TcpDisconnect(socknum: | ||
| + | |Disconnect from the server| | ||
| + | |||
| + | ^Function TcpConnected(socknum: | ||
| + | |Return **True** if the socket is connected| | ||
| + | |||
| + | ^Function TcpRead(socknum: | ||
| + | |Read data from the socket until the character **termchar** is encountered, | ||
| + | |||
| + | ^Function TcpReadCount(socknum: | ||
| + | |Read data from the socket until **count** character are read or **timeout** is reached| | ||
| + | |||
| + | ^Function TcpWrite(socknum: | ||
| + | |Write data to the socket from **buf** for a length of **count**| | ||
| + | |||
| + | ^Procedure TcpPurgeBuffer(socknum: | ||
| + | |Purge all the received data currently queued in the receive buffer| | ||
| - | ^function | ||
| - | |Execute one of the [[server_commands|Skychart server]] command. Add the command name first to the string list, then each parameter. | | ||
| - | ^procedure SendInfo(origin, | ||
| - | |Send a message to the clients connected to the [[server_commands|Skychart server]].| | ||
en/documentation/script_reference.1402838854.txt.gz · Last modified: 2015/11/06 20:35 (external edit)
