Apple Script, URL Scheme and UDP Broadcast

Many of MacLoggerDX's function are AppleScriptable, allowing our customers to extend it's capabilities. Customer created and contributed scripts are delivered in the Extras folder of the MacLoggerDX download disk image. These scripts were not written or supported by Dog Park Software Ltd. but are provided for your use and reference in creating new scripts.

Sample Scripts

-- MacLoggerDX Scripting commands


tell application "MacLoggerDX"

-- General

get version

get connected

get mode

get mapped_mode

get frequency

get splitKhz

get power

get powerMultiplier

get driver

count every qso

exists qso "W1AW"

get call of qso 1

get first_name of qso 1

get last_name of qso 1

call of every qso whose call starts with "W7"

-- PTT : uses method chosen in Radio Prefs Keyer Popup

setPTT "ON"

delay 1

setPTT "OFF"

-- Lookup

lookup "W1AW"

delay (1) -- lookups are all async, give it time to complete

-- Session

setRSTR 599

setRSTS 599

setRCVD "SRX String Test"

setGRID "FN03jq"

setPOWER 95

setNOTE "test Comment"

-- Logging

setModeMapping "USB PSK31"

setVFOandMode "14.070 USB"

setSplitKhz "-5"

setVFOLoggingOffset "0.00001"

setLogTimeOn "2017-07-23 14:04:00"

setLogTimeOff "2017-07-23 14:08:00"

log

-- when radio is not connected sets Contest/DX Display for logging

-- when radio is connected sets radio frequency and mode as well

setLogFrequency "14.100"

setLogMode "CW"

log

-- DXCluster -- added Version 5.59

-- The processSpot script command processes spots from the extra_cluster program so that

--   MacLoggerDX users can merge spots from more than one DXCluster.

processSpot "DX de RA4FDY:     7076.0  UR4MP        TNX QSO JT65                   1600Z"

end tell

--

-- exportADIF(adif_output_file_path,  startDate,  endDate, stampQSLSent);

-- MacLoggerDX will select the QSOs in the date range (UTC), select them in the log panel and export them, overwriting the file named.

-- if startDate and endDate are not supplied then QSOs previously selected in the Log Panel are exported

-- stampQSLSent can be 0 (don't stamp QSL Sent) or 1 (Stamp QSL Sent)

-- adif_output_file_path is required

-- the "~" is expanded to a full path

-- (Note: the 1 2,3 or 4 parameters are required and separated by commas)

--


tell application "MacLoggerDX"

exportADIF "~/Desktop/ExportedADIFDateRange.adi, 2010-01-01 00:01, 2012-12-31 23:59, 1"

--exportADIF "~/Desktop/ExportedADIFSelected.adi, 1"

end tell

 

 

-- 

-- Import a single QSO as ADIF text

-- escape all quotation marks and \ with \ for example: "Quoted Text" -> \"Quoted Text\"

-- 

set adifText to "<CALL:5>HG2DX<NAME:23>Zsolt \" JOE\" Kecskemeti<QTH:12>Majsai ut 8.<QSO_DATE:8>20160426<TIME_ON:6>191450<TIME_OFF:6>191452<FREQ_RX:6>14.252<FREQ:6>14.252<BAND:3>20M<BAND_RX:3>20M<MODE:3>SSB<TX_PWR:2>13<ANT_AZ:4>48.3<RST_SENT:2>58<RST_RCVD:3>456<QSL_VIA:54>Direct, LOTW, E-QSL\"AG, NO buro QSL!, eQSL, Mail, LoTW<DXCC:3>239<COUNTRY:7>Hungary<CQZ:2>28<ITUZ:2>15<MY_SOTA_REF:8>G/LD-003<GRIDSQUARE:6>KN06cq<LAT:11>N046 40.239<LON:11>E020 14.542<MY_GRIDSQUARE:6>FN03jq<OPERATOR:6>VE3VRW<MY_RIG:9>Flex 6300<COMMENT:64>aliases:HG4W, qrzloc:user, Uploaded to Club Log 2016-04-26 19:14<EOR>"


tell application "MacLoggerDX"

importADIF adifText

end tell

 


Called Script

If the qso_was_logged.scpt AppleScript exists in your ~/Documents/MLDX_Logs folder it will be called when MacLoggerDX logs a QSO.

A sample template of the qso_was_logged.scpt can be found in the download disk image Extras/Sample Files/V5 Scripts/ Folder.

-- 

-- If it exists in the ~/Documents/MLDX_Logs folder,

-- the "qso_was_logged" script is called when MacLoggerDX logs a QSO.

-- suggested by WA1OUI February 2016

-- 

on qso_logged(call, qso_done, rx_frequency, tx_frequency, band_rx, mode, power, dxcc_id, dxcc_country, city, state, first_name, last_name, adif_string)

-- comment out the "display dialog" and add your own code

display dialog call & ", " & qso_done & ", " & rx_frequency & ", " & mode & ", " & first_name & ", " & last_name & ", " & dxcc_country

end qso_logged

 

MacLoggerDX AppleScript Dictionary

If you drop the MacLoggerDX app onto the AppleScript editor, it will display the script dictionary...

 

URL Scheme

If any application opens a URL in this scheme - mldx://tune?freq=14.240&mode=USB with openURL MacLoggerDX will be started or brought forward and if a radio is connected it will be set to this frequency (14.240) and mode (USB) or else the displayed frequency will be set to 14.240 and the displayed Mode will be set to USB. mldx://lookup?call=CALLSIGN is also supported.

Test links:

mldx://tune?freq=14.100&mode=CW

mldx://tune?freq=14.240&mode=USB&power=95&splitKhz=-10

mldx://tune?freq=52.525&mode=FM

mldx://lookup?call=VE3VRW

mldx://ptt?state=ON

mldx://ptt?state=OFF

N1MM UDP Broadcast

The limited broadcast address nnn.nnn.nnn.255 is used for broadcasting messages from MacLoggerDX to any program running on any computer (Mac, PC etc.) on your LAN subnet that can receive and interpret N1MM formatted XML Radio and spot reports. (exisiting Mac ip address nnn.nnn.nnn.nnn with the fourth octet replaced by 255 for broadcast to the subnet).

MacLoggerDX transmits on UDP Port 12060 whenever the connected radio VFO changes, (Enable the N1MM UDP check box in Station Prefs).

 

UDP Broadcast

Radio Report Packet

The limited broadcast address nnn.nnn.nnn.255 is used for broadcasting messages from MacLoggerDX to any program running on any computer (Mac, PC etc.) on your LAN subnet. (exisiting Mac ip address nnn.nnn.nnn.nnn with the fourth octet replaced by 255 for broadcast to the subnet).

The udp_listener application in the Download Extras folder will display radio report packets that MacLoggerDX transmits on UDP Port 9932 whenever the connected radio VFO changes, the connected rotor is moved, a QSO is logged, a spot is received or a spot lookup is done (Enable UDP Broadcast check box in Station Prefs).



This application can be used for testing by developers who want to receive, process and act on these UDP packets.

Sample Packet

2014-12-28 1:12:41.910 PM udp_listener[2427]: socketCallback:UDP ip:10.0.1.253:9932 msg:000210 dogpark_dev (2)
[Radio Report:RxMHz:18.15400, TxMHz:18.15400, Band:17M, Mode:USB, Power:5]

Packet Types