Get and Display Info for a QSO

Description

  • This routine requires that the “Call” field in the Log Entry area is selected. Otherwise, the routine will not run correctly.
  • There are many useful routines contained in the code including:
    • getCallSignToLookup
    • doesQSOexist
    • lookupCallSign
    • displayQSOinfo
    • gatherQSOinfo
    • getLogEntryPanelCallSign
    • getLogEntryPanelFirstName
    • getLogEntryPanelLastName

Code

— This routine assumes that the the “Call” field of the Log Entry area of
MacLoggerDX is selected.

set findCallSign to getCallSignToLookup() as text –the call sign to find

if doesQSOexist(findCallSign) then
lookupCallSign(findCallSign)
set infoList to gatherQSOinfo()
displayQSOinfo(infoList)
end if

on doesQSOexist(theCallSign as text)
tell application “MacLoggerDX”
exists qso theCallSign
end tell
end doesQSOexist

on lookupCallSign(theCallSign as text)
tell application “MacLoggerDX”
activate
lookup theCallSign
delay (1)
end tell
end lookupCallSign

on getCallSignToLookup()
tell application “MacLoggerDX”
activate
set dialogResult to display dialog “Enter the call sign of the QSO
to lookup:” with title “Call Sign Entry Dialog” with icon 1

default answer “K8UKE” giving up after 15
set theCallSign to text returned of dialogResult
end tell
return theCallSign
end getCallSignToLookup

on displayQSOinfo(infoList)
tell application “MacLoggerDX”
activate
set theInfo to “The QSO was with call sign ” & item 1 of infoList
& “. The operator was ” & item 2 of infoList & ” ” &
item 3 of infoList & “.” as text
display dialog theInfo with title “QSO Information Display”
buttons {“OK”} default button “OK” with icon 1
end tell
end displayQSOinfo

on gatherQSOinfo()
set theResult to {“”, “”, “”}
set item 1 of theResult to getLogEntryPanelCallSign()
set item 2 of theResult to getLogEntryPanelFirstName()
set item 3 of theResult to getLogEntryPanelLastName()
return theResult
end gatherQSOinfo

on getLogEntryPanelCallSign()
tell application “MacLoggerDX”
tell application “System Events”
tell process “MacLoggerDX” to keystroke “c” using
command down
delay 0.1
end tell
end tell

return the clipboard as text
end getLogEntryPanelCallSign

on getLogEntryPanelFirstName()
tell application “MacLoggerDX”
tell application “System Events”
tell process “MacLoggerDX”
keystroke tab & tab & tab
keystroke “c” using command down –Copies First Name
delay 0.1
end tell
end tell
end tell

set firstName to the clipboard as text
if word 1 of firstName = “Dr” or word 1 of firstName = “Dr.” then

–Gets the real first name
set firstName to word 2 of firstName
else
set firstName to word 1 of firstName

end if
return firstName
end getLogEntryPanelFirstName

on getLogEntryPanelLastName()
tell application “MacLoggerDX”
tell application “System Events”
tell process “MacLoggerDX”
keystroke tab & tab & tab & tab
keystroke “c” using command down –Copies Last Name
delay 0.1
end tell
end tell
end tell
set firstName to the clipboard as text
set firstName to word 1 of firstName as text
return firstName
end getLogEntryPanelLastName