Newbie: Need Windows batch file to compose a message

60 views
Skip to first unread message

Ric Fel

unread,
Apr 16, 2024, 10:22:39 PMApr 16
to pat-users
Just introduced to the Pat project today! I’m looking to automate sending ‘system health’ messages via email from Windows computers in our club station. I can successfully compose and send interactively using the command-line, however, not successful in combining the options for the ‘compose’ command in a single string that gets it posted.
Typing
>pat compose help
Options don’t seem clear me, e.g. no option for to:, nor option for message body, exit.

I’ve tried “pat compose -r <mycall> -s My Subject line add...@gmail.com “ and hitting ENTER takes me to message body. I can enter text, and CTRL-C posts the message to the outbox.
However, 
I simply need complete string that I can place in a batch file and get it posted to the outbox

Thanks/

Benjamin Seidenberg

unread,
Apr 17, 2024, 1:54:42 PMApr 17
to pat-users
Hi Ricky!

I'm away from my computer right now, but hopefully these pointers will start you in the right direction:

The non-interactive mode is designed to look like the traditional unix sendmail command, so that's the mental model to follow

The body of the message comes in on standard input. The list of recipients is passed as arguments with no flags.

Ole Saastad

unread,
Apr 17, 2024, 2:02:01 PMApr 17
to pat-users
I have been thinking along the same lines, but not really accept the challenge. I want to automate a request for weather data like :

-r <mycall> -s grib  qu...@saildocs.com  send gfs:40N,70N,10W,20E|1,1|6,12,24,36,48,72,96|PRESS,WIND  <enter> or <Ctrl-D> 

The subject is not parsed, but the body need to contain the string given. This could be automated to be an icon or a simple command. 
In a rolling boat anything that can be made simple is nice. It should be possible to disable the editor and just give the complete string
including the email body in a single line. 

Ole / 73

Benjamin Seidenberg

unread,
Apr 17, 2024, 4:53:30 PMApr 17
to Ole Saastad, pat-users
echo 'send gfs:40N,70N,10W,20E|1,1|6,12,24,36,48,72,96|PRESS,WIND' | pat compose -s "grib" qu...@saildocs.com

Followed by pat connect <options>.

Can put it all in a .bat file

--
You received this message because you are subscribed to a topic in the Google Groups "pat-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pat-users/UJRMP2mUfP8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pat-users+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pat-users/c6b75481-f91f-4d6f-b4e7-6945cee45c63n%40googlegroups.com.

Ric Fel

unread,
Apr 17, 2024, 8:34:03 PMApr 17
to pat-users
Ole, I could only get your saildoc's query (seemingly) to work using the following inside of a windows .bat file.
(echo send gfs:40N,70N,10W,20E/1,1/6,12,24,36,48,72,96/PRESS,WIND)| pat compose -s "grib" qu...@saildocs.com

Ric Fel

unread,
Apr 18, 2024, 4:35:00 PMApr 18
to pat-users
I got PAT functionally working to compose an email, with msg body - in a single command-line string within a windows batch file. Sample files attached - summary below. Thanks to all who pointed me in the right direction.

rem Set Variable for use in option 2 & 3 to generate a new-line for the multi-line message body text
set nl=^&echo.

rem OPTION 1: Reads in file contents and places the text into the message body
rem pat compose -s "get NOAA Forecast" NWS.FTP...@noaa.gov < noaa_zone_list.txt

rem OPTION 2: Pipes in the lines to be used in the message body
(echo open%nl%get data/forecasts/zone/tx/txz177.txt%nl%quit%nl%) | pat compose -s "get NOAA Forecast" NWS.FTP...@noaa.gov

rem OPTION 3: Pipe-in email msg to an email provider address and a winlink address
REM (echo body line 1%nl%body line 2%nl%) | pat compose -s "Pipe in TEST from winlink" my_ad...@gmail.com my_winlink_address

rem OPTION 4: Subject Line only message to an email provider address and a winlink address
rem (echo.) | pat compose -s "Subject-line only TEST from winlink to gmail and winlink" my_ad...@gmail.com my_winlink_address

rem Send the message using Telnet | AX25 | varhf | varafm
pat connect telnet
...

noaa_zone_list.txt
PAT_get_noaa.bat.txt

Ole Saastad

unread,
Apr 19, 2024, 4:09:08 AMApr 19
to pat-users
The fact that pat accept piping to stdin in compose mode (I did not know that before) open up for normal shell scripting, here an example:

#!/bin/bash

echo "Generating weather package request for PAT"

# Each file sent as a separate request. As one chart if tens of kilobytes it's
# better to split them up. HF propagation can be bad at times, take one at the time.
#
#  
# PPVA89.TIF Surface Analysis (North Atlantic)
# PPVE89.TIF 24HR Surface Forecast (North Atlantic)                          
# PPVI89.TIF 48HR Surface Forecast (North Atlantic)                          
# PPVK89.TIF 72HR Surface Forecast (North Atlantic)                          
#
# ICON:50N,70N,10W,20E|0.25,0.25|0,24,48|WIND,MSLP
# ECMWF:50N,70N,10W,20E|0.25,0.25|0,24,48|MSLP,WIND

for meteo in PPVA89.TIF PPVE89.TIF PPVI89.TIF \
            "ICON:40N,70N,10W,20E|0.25,0.25|0,24,48|WIND,MSLP"; do
    
   (echo send $meteo ) | cat
   #(echo send $meteo ) | pat compose -s request qu...@saildocs.com
done


As it sometimes easier to click a button than edit files in a rolling yacht a GUI might be written to select ICON, ECMWF or GFS for the GRIB or select forecast times with click boxes etc. 
Using current GPS to request a GRIB sample square around the current position (that might a nice Python script).

Ole / S/Y Algol / LB4PJ / 73 
Reply all
Reply to author
Forward
0 new messages