This file has been automatically generated by the LuaApiDoc.awk script v1.4.1 on May 16 2023 (13:42:17) Win-Test Lua API version 1.10.0 List of constants: http://download.win-test.com/v4/lua/constants.wts Lua Events ========== The following scripts names (with a .wts extension) are called on various events. Unless specified, the scripts must be located in the scripts directory. login.wts Called twice when an op. logs in. The first script must be located in the root op. directory, which is independent of the log callsign and contest ID. The second script must be located in the log_callsign/contest_ID op. directory logout.wts Called twice when an op. logs out. The first script must be located in the root op. directory, which is independent of the log callsign and contest ID. The second script must be located in the log_callsign/contest_ID op. directory onBandChange.wts Called when a band changes on a radio. wtArg = "BandName/RadioId" If the radio is out of bands, the BandName is set to "0" [1.9.1] onMicrohamFsOn.wts Called when the footswitch of a MicroHAM device is pressed. wtArg = RadioId onMicrohamFsOff.wts Called when the footswitch of a MicroHAM device is released. wtArg = RadioId onOtrspCrOn.wts Called if the OTRSP has control that generates an event with value 1. wtArg = CtrlNbr CtrlNbr: 1 to 9 onOtrspCrOff.wts Called if the OTRSP has control that generates an event with value 0. wtArg = CtrlNbr CtrlNbr: 1 to 9 onOtrspEvent.wts Called if the OTRSP has control that generates an event. wtArg = (256 * CtrlNbr) + State CtrlNbr: 1 to 9 State : 0 to 255 onFileOpen.wts Called when a contest file is opened onFileClose.wts Called when a contest file is closed Class wtApp =========== wtApp:TextCommand(strCommand [, strStation [, nNotificationID]]) strCommand is a WT text command. [1.3.0] : strStation and nNotificationID added. strStation is the Station name on the network to send the command to. Use "*" to send to all stns of the network [1.9.0] nNotificationID is the ID of the notification issued after the completion of the command (see WT_REMOTE_NOTIFY_* constants). wtApp:AlertBox(strText) Display a alert box with strText wtApp:MessageBox(strText, nType, strTitle) nType => See MessageBox options Return the button pressed to exit the message (can be ignored) wtApp:Sleep(nDuration) nDuration is expressed in ms wtApp:GetKeyState() Returns the modifiers keys status when the function is called wtApp:SendKeyCode(nKeyCode [, nModifiersKeys]) Send a key by its ASCII code nKeycode is an ASCII code nModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt = 2, Shift = 1, None = 0 - Can be combined) If this argument is missing or -1, the current modifiers keys are used wtApp:SendKey(strKey [, nModifiersKeys]) Send key or string strKey is a single character or a string nModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt = 2, Shift = 1, None = 0 - Can be combined) If this argument is missing or -1, the current modifiers keys are used wtApp:SendFKey(strKey [, nModifiersKeys]) Send Functions keys (and Insert and Plus) strKey is one of "F1".."F12" + "Insert" + "Plus" + "Esc" + "Tab" nModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt = 2, Shift = 1, None = 0 - Can be combined) If this argument is missing or -1, the current modifiers keys are used wtApp:SendAltKey(strKey) strKey is a letter, a number, or a function key ("F1".."F12" + "Insert" + "Plus" + "Esc") wtApp:SendCtrlKey(strKey) strKey is a letter, a number, or a function key ("F1".."F12" + "Insert" + "Plus" + "Esc" + "Tab") wtApp:IsCapsLock() Return a boolean (true or false) depending on the Caps Lock key state wtApp:SetCapsLock() Set the Caps Lock key ON wtApp:ResetCapsLock() Set the Caps Lock key OFF wtApp:ToggleCapsLock() Toggle the Caps Lock key wtApp:InputText(strPrompt, strTitle, strDefault) If strTitle or strPrompt is empty, a default text is used Returns nil if the dialog is exited with Esc or Cancel. wtApp:InputUpperText(strPrompt, strTitle, strDefault) If strTitle or strPrompt is empty, a default text is used Returns nil if the dialog is exited with Esc or Cancel. wtApp:InputNumber(strPrompt, strTitle, strDefault) If strTitle or strPrompt is empty, a default text is used Returns nil if the dialog is exited with Esc or Cancel. wtApp:InputInteger(strPrompt, strTitle, strDefault) If strTitle or strPrompt is empty, a default text is used Returns nil if the dialog is exited with Esc or Cancel. wtApp:ShowWindow(nChildWndId) Show the child window designated by its windowID (see the wtConstants list) wtApp:HideWindow(nChildWndId) Hide the child window designated by its windowID (see the wtConstants list) wtApp:ToggleWindow(nChildWndId) Toggle the child window designated by its windowID (see the wtConstants list) wtApp:WizzWindow(nChildWndId) Wizz the child window designated by its windowID (see the wtConstants list) wtApp:SetWindowColor(nChildWndId, nRed, nGreen, nBlue, nColorIndex) Set the nColorIndex color of the child window designated by its windowID (see the wtConstants list) If nChildWndId is < 0, it applies to the main window. If nColorIndex is omitted (or set to 0), it applies to the background color All colors must be <= 255. wtApp:CallScript(strScript[, parameter]) Call a wts script (no extension required in strScript) with an optional parameter that will be assigned to wtArg in the called script. This parameter can be a number, a string, or a boolean. For more complex types, use a global Lua variable. Can return a number only (or nothing) Note : Deprecated. Use wtScript:Call(strScript[, parameter]) instead for newer scripts. wtApp:IsPostKeyProcess() Return true if the current script is executed after the assigned key has been processed by WT, and false otherwise wtApp:GetLogPath() Return the path of the log directory wtApp:GetAppPath() Return the path of the Win-Test application directory wtApp:GetCfgPath() Return the path of the Win-Test cfg directory wtApp:GetCtyPath() Return the path of the country files directory wtApp:GetDatabasePath() Return the path of the database files directory wtApp:GetOpPath() Return the path of the ops directory wtApp:GetScriptPath() Return the path of the scripts directory wtApp:GetExtraPath() Return the path of the extra files directory wtApp:GetCurrentOpPath() [1.9.0] Return the path of the current op. directory wtApp:GetLogFileName() Return the name if the log file (no path) wtApp:GetIniFileName() Return the name if the ini file (no path) wtApp:GetLuaApiVersion() Return the current Lua API version wtApp:ResetForceBindToNonActiveRadio() Bind further commands to the active radio (cancels wtApp:SetBindToNonActiveRadio()) wtApp:SetForceBindToNonActiveRadio() Bind further commands to the non active radio wtApp:GetForceBindToNonActiveRadio() Return TRUE if commands are bind to the non active radio, else return FALSE wtApp:ResetForceBindToActiveRadio() Bind further commands to the active radio (cancels wtApp:SetBindToActiveRadio()) wtApp:SetForceBindToActiveRadio() Bind further commands to the non active radio wtApp:GetForceBindToActiveRadio() Return TRUE if commands are bind to the non active radio, else return FALSE wtApp:PostMessage(strTitle, strClass, nMsg, nWParam, nLParam[, strLParam]) [1.5.0] Place (post) a message in the message queue associated with the thread that created the specified window and returns without waiting for the thread to process the message. strTitle : Title of the target window strClass : Specifies the window class name of the child window (must be empty if unused) nMsg : Message to be posted nWParam : Additional message-specific information (use 0 if unused) nLParam : Additional message-specific information (use 0 if unused) strLParam : String as additional message-specific information wtApp:SendMessage(strTitle, strClass, nMsg, nWParam, nLParam[, strLParam]) [1.5.0] Send the specified message to a window. The SendMessage function calls the window procedure for the specified window and does not return until the window procedure has processed the message. strTitle : Title of the target window strClass : Specifies the window class name of the child window (must be empty if unused) nMsg : Message to be posted nWParam : Additional message-specific information (use 0 if unused) nLParam : Additional message-specific information (use 0 if unused) strLParam : String as additional message-specific information Return the string "FAIL" if there was a problem or the command timed out. Otherwise, it is set to the numeric result of the message, which might sometimes be a "reply" depending on the nature of the message and its target window. wtApp:GetLastError() [1.5.0] Return the Windows last-error code value when using PostMessage or SendMessage. Can be useful to debug such statements. wtApp:Timeout(nDuration) Similar as wtApp:Sleep except that Win-Test is not blocked while the API is executed nDuration is expressed in ms wtApp:TimeoutBox(nDuration, [strText, [bAbortEnabled]]) [1.10.0] Displays a dialog box with a timeout progress bar, an optional centered text and an (optionally enabled) abort button. Win-Test is not blocked while the API is executed. nDuration expressed in milliseconds (min 100 ms). strText : Caption of the centered static text above the progress bar. bEnableAbort : Boolean to enable the abort button. By default, this button is disabled. Class wtContest =============== wtContest:IsExchangeRequired() Return a boolean. True if the current contest requires an exchange wtContest:GetContestId() Return the current contest ID wtContest:GetCategoryId() [1.7.0] Return the current category ID wtContest:GetModeCategoryId() [1.7.0] Return the current mode category ID wtContest:GetOverlayId() [1.7.0] Return the current overlay ID wtContest:GetPowerClassId() [1.7.0] Return the current power class ID wtContest:GetMyCallsign() [1.1.0] Return my callsign Class wtGab =========== wtGab:Send(strText[, strToStation [, bDontLog]]) Send a gab strText to strToStation. If strToStation is omitted or empty (""), the text is sent to the whole network. If bDontLog is equal to true, the gab line won't be displayed in the gab window [1.10.0] Class wtKeyer ============= wtKeyer:Play(strMessage [, nRadio] ) strMessage is a plain string to be played, a saved message ($F1 etc.) or a variable ($xxx) nRadio is optional : If omited the current bound radio is used. If not, use WT_RADIO_1 (= 0) or WT_RADIO_2 (= 1) wtKeyer:PlayAdditionalMsg(nAdditionalMsgIndex [, nRadio]) nAdditionalMsgIndex is the index of the Alt-C messages set (1 to 12). Other are ignored. nRadio is optional : If omited the current bound radio is used. If not, use WT_RADIO_1 (= 0) or WT_RADIO_2 (= 1) wtKeyer:Stop() Stop the current message wtKeyer:GetCwSpeed() Return the CW speed in wpm (return 0 in case of error) wtKeyer:SetCwSpeed(nSpeed) Set the CW speed in wpm wtKeyer:GrabHighlightedCallsign([nRadio]) ONLY for RTTY : Grab the highlighted callsign in the RTTY wnd. It relies on the INSERT key option set in the RTTY setup dialog. nRadio is optional : If ommited the current bound radio is used. If not, use WT_RADIO_1 (= 0) or WT_RADIO_2 (= 1) wtKeyer:Insert(strData) Insert strData in the CW or RTTY stream. Mainly used by scripts called synchroneously. wtKeyer:Load(strFileName) [1.9.0] Load the messages from the strFileName file (must be a .smsg file). If no path is specified, it uses the current op. directory. Return true in case of error. wtKeyer:SetMessage(strKey, strMessage, nBank) [1.9.0] Set the message for strKey in nBank, that can be WT_MSG_BANK_RUN (default) or WT_MSG_BANK_SP, to strMessage Class wtMicroham ================ wtMicroham:GetDeviceId() Return the microHAM device ID - See the Lua constants for interpretation wtMicroham:GetFirmwareVersion() Return the firmware version of the microHAM device wtMicroham:Send(strCommand) Send the strCommand string to the attached microHAM device The trailing character is optional, and is appended if needed. Class wtOp ========== wtOp:GetCallsign() Return the current op callsign wtOp:GetNick() Return the current op nick wtOp:GetPath() [1.9.0] Return the path of the current op. directory Class wtOtrsp ============= wtOtrsp:GetDeviceName() Return the name of the OTRSP device wtOtrsp:GetFirmwareVersion() Return the firmware version of the OTRSP device wtOtrsp:Send(strCommand) Send the strCommand string to the attached OTRSP device. The trailing character is optional, and is appended if needed. Class wtQso =========== wtQso:IsCallsignEmpty() Return a boolean : True if the callsign field of the active Qso is empty wtQso:IsCallsignIncomplete() Return a boolean : True if the callsign field of the active Qso contains a "?" wtQso:IsExchangeEmpty() Return a boolean : True if the exchange field of the active Qso is empty wtQso:IsExchangeSent() Return a boolean : True if the exchange of the active Qso has been sent wtQso:SetExchangeSent() Set the exchangeSent flag of the active Qso (see wtQso::IsExchangeSent()) wtQso:ResetExchangeSent() Clear the exchangeSent flag of the active Qso (see wtQso::IsExchangeSent()) wtQso:ClearStatus() Clear the status flags of the active Qso wtQso:IsCallsignRepeated() Return a boolean. True if the callsign hasn't changed wtQso:IsOperatingModeRun() Return a boolean. True if the operating mode of the active Qso is RUN (and False if S&P) wtQso:IsModePhone() Return a boolean. True if the mode of the active Qso is Phone (SSB and FM), and False otherwise wtQso:IsModeDigital() [1.6.0] Return a boolean. True if the mode of the active Qso is Digital (RTTY, etc.), and False otherwise wtQso:IsModeCw() [1.6.0] Return a boolean. True if the mode of the active Qso is CW, and False otherwise wtQso:GetModeId() Return the mode ID of the active Qso wtQso:IsQsoApproved() Return a boolean. True if all requested fields of the active Qso are filled (contest dependent) wtQso:IsDupe() Return a boolean. True if the current Q is a dupe wtQso:IsCurrentFieldCallsign() Return a boolean : True if the current field is the callsign field wtQso:IsCurrentFieldExchange() Return a boolean : True if the current field is an exchange field wtQso:IsCurrentFieldOther() Return a boolean : True if the current field is not the callsign field or an exchange field wtQso:IsCurrentFieldEmpty() Return a boolean : True if the current field is empty (except RST for the exchange field) wtQso:IsCurrentFieldPrimaryRadio() Return a boolean : True if the current field is in the primary radio (main log) wtQso:IsCurrentFieldSecondaryRadio() Return a boolean : True if the current field is in the secondary radio wtQso:GetData([nQsoNum]) Return a Lua table of several data fields of the nQsoNum QSO If nQsoNum is omitted or equal 0, the current QSO is considered. If nQsoNum is out of bounds, nil is returned. Table keys : "time", "band", "mode", "freq", "callsign", "rstSent", "serialSent", "rstReceived", "exchReceived", "miscInfoReceived", "miscInfo2Received", "gridsquare", "stnName", "stnFlags" stnFlags : Bit 0 : RUN1/RUN2, Bit 1 : RUN/MULT, Bit 2 : SUPPORT / NOSUPPORT [1.3.0] : "stnName" and "stnFlags" added. [1.4.0] : "gridsquare" added. [1.6.0] : nQsoNum added. wtQso:SetSentSerial(nSerial) [1.10.0] If applicable, set the sent serial of the current QSO to nSerial Class wtRadio ============= See Class wtRadioGeneric Class wtRadio1 ============== See Class wtRadioGeneric Class wtRadio2 ============== See Class wtRadioGeneric Class wtRadioGeneric ==================== CAUTION : The following functions can apply to: wtRadio (the active one), wtRadioInactive (the non-active one), wtRadioPrimary (the one that is in the main log wnd), wtRadioSecondary (the one that is in the secondary log wnd), wtRadio1 and wtRadio2 WARNING : Some functions may not work because of the CAT protocol or radio hardware limitations wtRadio*:GetFreq() Return freq of the active VFO of the designated radio freq is expressed in kHz wtRadio*:GetFreq(nVfo) Return freq of the designated VFO (0 => VFO A, 1 => VFO B) of the designated radio freq is expressed in kHz wtRadio*:GetFreqInactiveVfo() Return freq of the inactive VFO of the designated radio freq is expressed in kHz wtRadio*:SetFreq(fFreq) Set freq of the active VFO of the designated radio The function is ignored if the frequency is outside any band. [1.6.0] fFreq is expressed in kHz wtRadio*:SetFreq(fFreq, nVfo) Set freq of the designated VFO (0 => VFO A, 1 => VFO B) of the designated radio The function is ignored if the frequency is outside any band. [1.6.0] fFreq is expressed in kHz wtRadio*:SetFreqInactiveVfo(fFreq) Set freq of the inactive VFO of the designated radio fFreq is expressed in kHz wtRadio*:SetFreqSubVfo(fFreq) Set freq of the sub VFO of the designated radio fFreq is expressed in kHz wtRadio*:SetSplit(fFreq) Set split ON and the split frequency on the designated radio fFreq is expressed in kHz wtRadio*:ResetSplit() Reset split on the designated radio wtRadio*:IsSplit() Return false or true whether the split is set or not on the designated radio wtRadio*:GetRadioId() Return the radioID (0 => RADIO_1, 1 => RADIO_2) of the designated radio wtRadio*:Send(strCat) Send the ASCII strCat string to the designated radio wtRadio*:SendHex(strHex) The strHex string must contains only 0-9 and A-F characters and must have a even length. Ex "02DFA8" etc. Send the strHex string to the designated radio wtRadio*:GetTypeId() Return the type of the radio - See the Lua constants for interpretation Warning : The radio *must* be attached to an interface wtRadio*:GetManufacturerId() Return the manufacturer of the radio - See the Lua constants for interpretation Warning : The radio *must* be attached to an interface wtRadio*:GetCqData() [1.8.0] Return a Lua table of several data fields of the last CQ data Table keys : "freq", "qsx", "band", "mode", "wpm" wtRadio*:GetBand() [1.8.0] Return the current band of the radio wtRadio*:GetMode() [1.8.0] Return the current mode of the radio Class wtRadioInactive ===================== See Class wtRadioGeneric Class wtRadioPrimary ==================== See Class wtRadioGeneric Class wtRadioSecondary ====================== See Class wtRadioGeneric Class wtScript ============== wtScript:Call(strScript[, parameter]) Call a wts script (no extension required in strScript) with an optional parameter that will be assigned to wtArg in the called script. This parameter can be a number, a string, or a boolean. For more complex types, use a global Lua variable. Can return a number only (or nothing) wtScript:AssignKeyCode(strScript, nKeyCode [, nModifiersKeys]) Assign a key - and optional modifiers keys to the wts strScript (no extension required in strScript) nKeycode is an ASCII code nModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt = 2, Shift = 1, None = 0 - Can be combined) If nKeyCode = 0, the key is unassigned to the script. wtScript:AssignKey(strScript, charKey [, nModifiersKeys]) Assign a key - and optional modifiers keys to the wts strScript (no extension required in strScript) nModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt = 2, Shift = 1, None = 0 - Can be combined). If charKey is an empty char, the key is unassigned. wtScript:AssignFKey(strScript, strKey [, nModifiersKeys]) Assign a function key - and optional modifiers keys to the wts strScript (no extension required in strScript) strKey is one of "F1".."F12" + "Insert" + "Plus" + "Esc" + "Tab" nModifiersKeys (optional) indicates the modifiers keys (Ctrl = 4, Alt = 2, Shift = 1, None = 0 - Can be combined). If strKey is an empty string, the function key is unassigned to the script. wtScript:AssignArgument(strScript, strArgument) Assign the strArgument argument to the wts strScript (no extension required in strScript). If strArgument is an empty string, the argument is unassigned to the script. wtScript:AssignTextCommand(strScript, strTextCmd) Assign the strTextCmd text command to the wts strScript (no extension required in strScript). If strTextCmd is an empty string, the text command is unassigned to the script. Class wtStatus ============== wtStatus:GetList() Return a Lua table with station names of all stations in the network wtStatus:GetMyStation() [1.1.0] Return my station name in the network wtStatus:GetStatus(strStationName) Return a Lua table of all status fields of a given station Return nil if the station is not in the network Table keys : "band" "mode" "currentRadio" "radio1Freq" "radio2Freq" "radio1IsManual" "radio2IsManual" "passFreq" "type" "qsyStatus" "operator" [1.2.0] : "operator" added wtStatus:GetFreq(strBand[,strMode]) Get the "best" pass freq for given band and mode : - Looks for the first R station on the given band and mode - If not found, look for the first R+ station on the given band and mode - If not found, look for the first M station on the given band and mode - If not found, look for the first M+ station on the given band and mode - If not found, return 0 :-(