ALL.TXT to ADIF

Generates fake QSOS from WSJTX all.txt file allowing shortwave listeners to use grid tracker to map out "Listens"
 avatar
unknown
plain_text
3 days ago
2.8 kB
8
Indexable
#WARNING DO NOT TRY AND UPLOAD THESE GENERATED LOGS TO ANYWHERE OTHER THAN OFFLINE GRID TRACKER
# Define input and output file paths
$inputFile = "C:\Users\<USERNAME>\AppData\Local\WSJT-X\all.txt"
$outputFile = "C:\data\SWLONLYDONOTUPLOAD.adi"

# Function to generate a random signal report
function Get-RandomRST {
    return ("-10", "-15", "-05", "00", "+05" | Get-Random)
}

# Function to determine band based on frequency
function Get-Band($frequency) {
    switch ($frequency) {
        {$_ -match "^1[4-5]\.074$"} { return "20M" }
        {$_ -match "^7\.074$"} { return "40M" }
        {$_ -match "^10\.136$"} { return "30M" }
        {$_ -match "^18\.100$"} { return "17M" }
        {$_ -match "^21\.074$"} { return "15M" }
        {$_ -match "^24\.915$"} { return "12M" }
        {$_ -match "^28\.074$"} { return "10M" }
        {$_ -match "^50\.313$"} { return "6M" }
        default { return "UNKNOWN" }
    }
}

# Read input file
if (!(Test-Path $inputFile)) {
    Write-Host "Input file not found!" -ForegroundColor Red
    exit
}

$qsos = @()

# Process each line in the file
Get-Content $inputFile | ForEach-Object {
    $line = $_ -split "\s+"
    
    # Ensure the line contains 'CQ', a callsign, and a valid 4-character grid square
    if ($line -match "CQ" -and $line.Length -ge 6) {
        $callsign = $line[-2]  # Callsign appears before the grid square
        $grid = $line[-1]      # Grid square is the last element
        $frequency = $line[1]
        
        if ($callsign -match "^[A-Z0-9/]+$" -and $grid -match "^[A-R]{2}[0-9]{2}$") {
            $date = (Get-Date -Format "yyyyMMdd")
            $timeOn = (Get-Date -Format "HHmmss")
            $timeOff = (Get-Date).AddMinutes(2).ToString("HHmmss")  # Simulating a 2-minute QSO
            $band = Get-Band $frequency
            $mode = "FT8"
            $rst_sent = Get-RandomRST
            $rst_rcvd = Get-RandomRST
            $my_callsign = "SWL/ZL"
            $my_grid = "RE54HJ"

            $qsos += "<QSO_DATE:$($date.Length)>$date <TIME_ON:$($timeOn.Length)>$timeOn <TIME_OFF:$($timeOff.Length)>$timeOff <CALL:$($callsign.Length)>$callsign <BAND:$($band.Length)>$band <FREQ:$($frequency.Length)>$frequency <MODE:$($mode.Length)>$mode <RST_SENT:$($rst_sent.Length)>$rst_sent <RST_RCVD:$($rst_rcvd.Length)>$rst_rcvd <GRIDSQUARE:$($grid.Length)>$grid <MY_GRIDSQUARE:$($my_grid.Length)>$my_grid <QSO_COMPLETE:1>Y <EOR>"
        }
    }
}

# Write to ADIF file
@"
ADIF Log Generated by PowerShell
<ADIF_VER:4>3.1.0
<PROGRAMID:10>PS-LogGen
<EOH>
"@ | Set-Content $outputFile -Encoding utf8

$qsos | ForEach-Object { "$_`n" } | Out-File -Append -FilePath $outputFile -Encoding utf8

Write-Host "ADIF file generated: $outputFile" -ForegroundColor Green
Leave a Comment