LUA user contributed

From Win-Test Wiki
Jump to: navigation, search

User contributed LUA Scripts

As the scripting language LUA opens the possibility to change WT-behaviour to personal needs, there are user contributed scripts available. This collection here is for your convenience. Please try and use at your own risk. These and other Win-Test scripts may be found at http://bit.ly/wtscripts.

Radio-specific Rig Control Scripts for DVR (Radio Voice Keyer) control, ClearRIT, SwapVFO, etc.

Elecraft K3

The following Elecraft K3 control scripts written by N6TV may be downloaded from http://www.kkn.net/~n6tv/K3scripts.zip. See Readme.txt for installation instructions:

Script Function Suggested Key Assignment
RITUp.wts Move RIT of active radio up one unit Shift-Up Arrow
RITDown.wts Move RIT of active down one unit Shift-Down Arrow
ClearRIT.wts Clear RIT of active radio Shift-Right Arrow
VFOAUp.wts Move VFO A up 10 Hz
VFOADown.wts Move VFO B down 10 Hz
SwapVFO.wts Swap VFO A/B
PlayM1.wts Play K3 DVR memory M1 F1
RptM1.wts Repeat play K3 DVR memory M1 Shift-F1
PlayM2.wts Play K3 DVR memory M2 F2
PlayM3.wts Play K3 DVR memory M3 F3
PlayM4.wts Play K3 DVR memory M4 F4
PlayHalt.wts Halt K3 DVR playback Escape
AltF9.wts Slow down CW keyer, keep K3 internal CW keyer speed (paddles) in sync Alt-F9
AltF10.wts Speed up CW keyer, keep K3 internal CW keyer speed (paddles) in sync Alt-F10
AltV.wts Slow down keyer, keep K3 internal CW keyer speed (paddles) in sync Alt-V
PageDown.wts Slow down keyer, keep K3 internal CW keyer speed (paddles) in sync PageDown
PageUp.wts Speed up keyer, keep K3 internal CW keyer speed (paddles) in sync PageUp
setK3KeyerSpeed.wts Internal script called by AltF9, AltF10, AltV, PageUp and PageDown (none)

Example ClearRIT.wts for Elecraft K3:

-- K3 clear RIT command (tap CLR)
wtRadio:Send("k31;swt53;k30;")         -- Tap RIT Clear, K3     
return -1                              -- No further keystroke processing

Example PlayM1.wts for Elecraft K3:

-- K3 Script to play K3 DVR Message 1
-- Assign to:  F1 key
-- Time-stamp: "25 October 2010 23:02 UTC"
-- Change log:
--   Sets the run frequency in the band map, the way that F1 does it
-- Written by N6TV

-- If SSB or FM contact
if (wtQso:IsModePhone()) then
   -- Tap M1 button on K3 
   wtRadio:Send("k31;swt21;k30;")

   -- If we're in run mode, save the new CQ frequency via Alt-F5
   if wtQso:IsOperatingModeRun() then
      wtApp:SendAltKey("F5")
   end
   -- No further keystroke processing
   return -1
else                                 
   -- Else, not phone, so do normal keystroke processing
   return 0
end

Example RptM1.wts for Elecraft K3:

-- K3 Script to play K3 DVR Message 1 in repeat mode
-- Assign to:  Shift-F1 key
-- Time-stamp: "25 October 2010 23:02 UTC"
-- Also sets the run frequency in the band map, the way that F1 does it
-- Change log:
-- 
-- Written by N6TV

-- If SSB or FM contact
if (wtQso:IsModePhone()) then
   -- Hold M1 button on K3 to start a repeating CQ
   wtRadio:Send("k31;swh21;k30;")

   -- If we're in run mode, save the new CQ frequency via Alt-F5
   if wtQso:IsOperatingModeRun() then
      wtApp:SendAltKey("F5")
   end
   -- No further keystroke processing
   return -1
else                                 
   -- Else, not phone, so do normal keystroke processing
   return 0
end

Yaesu FT-2000

The following Yaesu FT-2000 control scripts written by ND8L and N6TV may be downloaded from http://www.kkn.net/~n6tv/FT2000scripts.zip. See Readme.txt for installation instructions:

Script Function Suggested key assignment
RITUp.wts Move RIT of active radio up 10 Hz Shift-Up Arrow
RITDown.wts Move RIT of active down down 10 Hz Shift-Down Arrow
ClearRIT.wts Clear RIT of active radio Shift-Right Arrow
SwapVFO.wts Swap VFO A/B
VFOAtoB.wts Copy VFO A -> B Scroll Lock
PlayF1.wts Play Yaesu DVS Message 1 F1
PlayF2.wts Play Yaesu DVS Message 2 F2
PlayF3.wts Play Yaesu DVS Message 3 F3
PlayF4.wts Play Yaesu DVS Message 4 F4
PlayHalt.wts Halt DVS playback Escape

Example ClearRIT.wts for Yaesu FT-2000:

-- Script to clear RIT (Clarifier) FT-2000/FT-2000D
wtRadio:Send("RC;")                    -- Clear Clarifier, FT-2000
return -1                              -- No further keystroke processing

Example PlayF1.wts for Yaesu FT-2000"

-- Script to play FT-2000/FT-2000D DVR ---> F1 Ch-1 <---
if (wtQso:IsModePhone()) then          -- If SSB or FM contact
   wtRadio:Send("PB01;")               -- Tap F1 button on FT-2000 
   return -1                           -- No further keystroke procesing
else                                   -- Else, not phone
   return 0                            -- Normal keystroke procesing
end

ESM.WTS (Enter Sends Message)

The ESM.WTS script is used by Win-Test for the ESM-Mode (Enter Sends Message).

F5VIH/SV3SJ

comments

I've followed the instructions of Larry to have a custom esm script and managed to write one during the brakes of WAE (yes, this WAE could have more participants :-) and even test it during the contest. It worked great. Scripting seems to introduce no noticeable delays when the enter key is pressed.

I am not a strong contender how ESM should be, other than staying usable, intuitive and reproducible. What 5B4AGN suggested sounded pretty reasonable to me and here is my attempt.

Simply place it in the "scripts" directory of WT, named esm.wts (any other name and WT will ignore the external script). At the top of the script you will find a variable setting:

shortcq = false;

Setting it to true, it will convert the CQ calling and the TU part of the QSO in short forms (a la 5b4agn) and the exact contents of the messages are defined in the two lines that follow the shortcq setting. I have also added the possibility to have an exchange filled in and no call (in that case the script sends CL?)

I must say I am very impressed by the functionality that WT opens to the users with lua scripts. I would really like to see more API calls made available and WT functions using scripts (programmable keys, even so2r, etc)

In the mean time if you have suggestions to improve the script let me know. I can easily inlcude them.

Enjoy,

Nick

esm.wts

----------------------------------- 
-- Wintest ESM - Nick, F5VIH/SV3SJ
-- Set "shortCQ to true or false
-----------------------------------  
shortcq = false;
shortCQ = "$MYCALL"; shortTU = "$CORRECT ++TU-- $CR";
-- Send functions
function sendCq() wtQso:ResetExchangeSent(); if (wtQso:IsModePhone()) then wtApp:SendFKey("F1"); else if (shortcq) then wtKeyer:Play(shortCQ); else wtApp:SendFKey("F1"); -- Always use the function key end; end; end;
function sendExchangeRun() if (wtQso:IsModePhone()) then wtApp:SendFKey("F2"); wtKeyer:Play("$CR"); else wtKeyer:Play("$INSERT"); end; wtQso:SetExchangeSent(); end;
function sendExchangeAgain() if (wtQso:IsModePhone()) then wtApp:SendFKey("F2"); else wtKeyer:Play("$F5 $F7"); -- $LOGGED ? end; end;
function sendTu() if (wtQso:IsModePhone()) then if (shortcq) then wtKeyer:Play("$CR"); wtApp:SendFKey("F5"); else wtApp:SendFKey("PLUS"); end; else if (shortcq) then wtKeyer:Play(shortTU); else wtKeyer:Play("$PLUS"); end; end; wtQso:ClearStatus(); end;
function sendQuestionMark() wtQso:ResetExchangeSent(); if (wtQso:IsModePhone()) then wtApp:SendFKey("F7"); -- Again ? else wtKeyer:Play("$F7"); end; end;
function sendMyCall() if (wtQso:IsModePhone()) then wtApp:SendFKey("F4"); -- My call else wtKeyer:Play("$F4"); end; end;
function sendExchangeSAndP() -- Sends appropriate exchange when in S&P mode if (wtQso:IsModePhone()) then wtApp:SendFKey("F2"); -- 5NN EXCHANGE else wtKeyer:Play("$F2"); end; wtQso:SetExchangeSent(); end;
function sendAskForCall() if (wtQso:IsModePhone()) then wtApp:SendFKey("F7"); -- AGN else wtKeyer:Play("CL?"); end; end;
function askForNumber() if (wtQso:IsModePhone()) then wtApp:SendFKey("F6"); -- NR AGN else wtKeyer:Play("$F6"); end; end;
function askWithPartialCall() if (wtQso:IsModePhone()) then wtApp:SendFKey("F7"); -- AGN else wtKeyer:Play("$F5 ?"); end; end;
-- ESM core code
-- Return 0 (or return nothing) if we want the CR -- to be processed also by WT (ie log QSO) and -1 if not.
if (wtQso:IsOperatingModeRun()) then -- Run Mode if (wtContest:IsExchangeRequired()) then -- Usual contests requiring an exchange if (wtQso:IsCallsignEmpty()) then if (wtQso:IsExchangeEmpty()) then sendCq(); else -- we ve got an exchange but not a call, ask for the call sendAskForCall(); end; else -- call is not empty if (wtQso:IsExchangeSent()) then -- we have sent the exchage if (not wtQso:IsQsoApproved()) then if (wtQso:IsCurrentFieldCallsign() and not wtQso:IsExchangeEmpty()) then askWithPartialCall(); end; if (wtQso:IsCurrentFieldCallsign() and wtQso:IsExchangeEmpty()) then wtQso:ResetExchangeSent(); sendExchangeRun(); if (wtQso:IsCurrentFieldCallsign()) then wtKeyer:Play("$SPACEBAR") end; end; if (wtQso:IsCurrentFieldExchange() and wtQso:IsExchangeEmpty()) then askForNumber(); end; else -- qso has valid call and exchange if (wtQso:IsCurrentFieldExchange()) then sendTu(); else -- current field is not exchange (should be callsign) if (wtQso:IsCurrentFieldCallsign()) then wtQso:ResetExchangeSent(); sendExchangeRun(); if (wtQso:IsCurrentFieldCallsign()) then wtKeyer:Play("$SPACEBAR") end; end; end; end;
else -- have not sent exchange and we are in the call field sendExchangeRun(); if (wtQso:IsCurrentFieldCallsign()) then wtKeyer:Play("$SPACEBAR") end; end; end;
else -- The contest doesnt require an exchange to be received e.g. DXPed etc. if (not wtQso:IsQsoApproved()) then if (wtQso:IsCallsignEmpty()) then sendCq(); else if (wtQso:IsCallsignRepeated()) then sendExchangeAgain(); else sendExchangeRun(); end; end; else if (wtQso:IsExchangeSent()) then sendTu(); else sendExchangeRun(); end; end; end;
else -- S&P : The automatic exchange fill (if enabled) is disabled by WT if ( (wtQso:IsExchangeEmpty() and wtContest:IsExchangeRequired()) or not wtQso:IsQsoApproved() ) then if (wtQso:IsCallsignEmpty()) then sendQuestionMark(); else if (not wtQso:IsDupe()) then -- Call only if not dupe sendMyCall(); end; end; else if (wtQso:IsExchangeSent()) then wtQso:ClearStatus(); wtKeyer:Play("$CR"); return -1; -- Log it silently else if (not wtQso:IsDupe()) then -- Sent exchange only if not dupe sendExchangeSAndP(); end; end; end; end;
return -1; -- This script overrides the Win-Test CR process


Back to LUA / ESM Mode

Back to Main Page