[Dx4win] AutoHotKey script to import WSJT-X ADIF file
k2dbk at k2dbk.com
k2dbk at k2dbk.com
Tue Jun 23 20:57:19 EDT 2026
I've been using AutoHotKey for years to automate tasks on my PC, and I
finally got around to creating (Claude helped) a script to import the ADIF
file created by WSJT-X using a minimal number of keystrokes. The way it
works is that with DX4WIN running, pressing Ctrl+Alt+I will open the import
window, automatically select the file, and import it. It ends with the
"Import Results" window showing so that you can verify the imports. There
are more details in the comments of the script. If you want to run this,
you'll likely need to modify the ADIFPath variable at the beginning of the
file to match where it's stored on your computer. You could also use this to
import an ADIF file created by any other program (e.g., N1MM logger, POTA
loggers, etc.) by changing that variable.
If you're already using AHK you can just save this script and add something
like #Include "C:\Users\david\Documents\AutoHotkey\DX4WIN_Import.ahk" to the
beginning of your main script. I can try to provide some assistance if you
run into problems, but I wouldn't call myself an AHK expert. You can find
out about AHK at https://www.autohotkey.com/. If you're new, you'll want to
download version 2.0; this script probably won't work with the older 1.x
version and I haven't tried with any pre-release version.
Usual disclaimers apply - While this works fine for me, it might not work
for you, and I can't be responsible for any issues. I would advise you to
test this after you've saved your log (or ideally, run it against a test
log).
I've put a copy of the script on my website at
https://k2dbk.com/DX4WIN_Import.ahk, or you can copy the text below and save
in your favorite text editor:
; ============================================================
; DX4WIN ADIF Import Automation
; ============================================================
; Hotkey: Ctrl+Alt+I
;
; Sequence:
; 1. DX4WIN main window (ahk_class TQSOForm) -> Alt+F -> "I"
(Import/Export...)
; This opens the "Import / Export Filters" dialog (ahk_class
TPickIEFilter)
; 2. That dialog's own File menu -> Alt+F -> "I" (Import)
; This opens the standard Windows file picker
; 3. Type the ADIF path, press Enter
; 4. "Options for duplicate QSOs" dialog (ahk_class TAskDupesImport)
appears
; -> set dropdown to "Imported QSO is ignored" -> click OK
;
; If the "Import / Export Filters" dialog is already open when the hotkey is
; pressed, the script skips step 1 and jumps straight to opening Import from
; that dialog's File menu, instead of reactivating the main window (which
; would disrupt the already-open dialog).
; ============================================================
ADIFPath := "C:\ham program files\dx4w901\save\wsjtx_log.adi"
^!i::DoDX4WinImport()
DoDX4WinImport()
{
global ADIFPath
; --- Detect current state ---
if WinExist("ahk_class TPickIEFilter")
{
WinActivate("ahk_class TPickIEFilter")
if !WinWaitActive("ahk_class TPickIEFilter", , 3)
{
MsgBox("Could not activate existing Import / Export Filters
dialog.", "DX4WIN Import", "Iconx")
return
}
}
else
{
; --- 1. Activate DX4WIN main window ---
if !WinExist("ahk_class TQSOForm")
{
MsgBox("DX4WIN main window not found. Make sure DX4WIN is
running.", "DX4WIN Import", "Iconx")
return
}
WinActivate("ahk_class TQSOForm")
if !WinWaitActive("ahk_class TQSOForm", , 3)
{
MsgBox("Could not activate DX4WIN main window.", "DX4WIN
Import", "Iconx")
return
}
Sleep(300) ; extra buffer: WinWaitActive confirms active state, but
; keyboard input routing can lag slightly behind,
especially
; if another window from the same process previously had
focus
; --- 2. Open File menu, then Import/Export... ---
Send("!f")
Sleep(300)
Send("i")
Sleep(300)
; --- 3. Wait for "Import / Export Filters" dialog ---
if !WinWait("ahk_class TPickIEFilter", , 3)
{
MsgBox("Import / Export Filters dialog did not appear.", "DX4WIN
Import", "Iconx")
return
}
WinActivate("ahk_class TPickIEFilter")
if !WinWaitActive("ahk_class TPickIEFilter", , 3)
{
MsgBox("Could not activate Import / Export Filters dialog.",
"DX4WIN Import", "Iconx")
return
}
}
; --- 4. Inside that dialog: Alt+F -> Import ---
Send("!f")
Sleep(300)
Send("i")
Sleep(500)
; --- 5. Standard Windows file picker should now be open ---
if !WinWait("ahk_class #32770", , 3)
{
MsgBox("File selection dialog did not appear.", "DX4WIN Import",
"Iconx")
return
}
WinActivate("ahk_class #32770")
Sleep(200)
; --- 6. Type the full path into the filename field and confirm ---
Send("!n") ; Alt+N focuses filename field in standard Open
dialogs
Sleep(200)
Send("^a")
Send(ADIFPath)
Sleep(200)
Send("{Enter}")
; --- 7. "Options for duplicate QSOs" dialog ---
if !WinWait("ahk_class TAskDupesImport", , 3)
{
MsgBox("Options for duplicate QSOs dialog did not appear.", "DX4WIN
Import", "Iconx")
return
}
WinActivate("ahk_class TAskDupesImport")
if !WinWaitActive("ahk_class TAskDupesImport", , 3)
{
MsgBox("Could not activate Options for duplicate QSOs dialog.",
"DX4WIN Import", "Iconx")
return
}
Sleep(200)
; Try to set the dropdown directly. TWheelx1 is a custom control (not a
; standard ComboBox), so ControlSetText may or may not work depending on
; how it's implemented. We verify afterward and fall back if needed.
desiredText := "Imported QSO is ignored"
try
ControlSetText(desiredText, "TWheelx1", "ahk_class TAskDupesImport")
catch {
}
Sleep(200)
actualText := ""
try
actualText := ControlGetText("TWheelx1", "ahk_class
TAskDupesImport")
catch {
}
if (actualText != desiredText)
{
; Fallback: click the control to give it focus, then try typing
; the first letter to jump to the matching entry.
ControlClick("TWheelx1", "ahk_class TAskDupesImport")
Sleep(200)
Send("i")
Sleep(200)
try
actualText := ControlGetText("TWheelx1", "ahk_class
TAskDupesImport")
catch {
}
if (actualText != desiredText)
{
MsgBox("Could not confirm dropdown is set to '" . desiredText .
"'.`nCurrent value: '" . actualText . "'.`nPlease set it manually, then
click OK.", "DX4WIN Import", "Icon!")
return
}
}
; --- 8. Click OK ---
ControlClick("TBitBtn2", "ahk_class TAskDupesImport")
; --- 9. Done ---
Sleep(500)
ToolTip("ADIF import sent to DX4WIN")
SetTimer(() => ToolTip(), -2000)
}
More information about the DX4WIN
mailing list