Is there a command line option

341 views
Skip to first unread message

maryan...@gmail.com

unread,
Nov 30, 2020, 12:16:15 PM11/30/20
to pat-users
Our EmComm group uses Pat on a RPi.  This works great for WINLINK (shout out to the developers!)

In an emergency we will be asked to send Incident Command System (ICS) forms to our State and FEMA command centers.  They are completely Windows centric.  

WINLINK has ICS forms processing built-into RMS-Express.  It is possible to reverse engineer this but the last step has to interface with the existing PAT system.  I have the contents of the email worked out but it has to be created in the WINLINK format.

What I need for ICS213 is a command line option that I can use from a script (bash?)  to initiate an email, insert the "To", SubjectLine, Message, and attach an xml file.

Does a command line interface exist for this?

73,
Clark
K7LRK

Steve Magnuson

unread,
Nov 30, 2020, 12:34:47 PM11/30/20
to maryan...@gmail.com, pat-users
Hi Clark,

Some time ago, I wrote a shell script that I think does what you are looking for.

To use this script on a Pi, install dos2unix:

sudo apt update
sudo apt install dos2unix

The script itself is at https://github.com/AG7GN/nexus-utilities/blob/master/patmail.sh

Here’s the help screen for the script. Use the ‘-f’ option to attach an XML file to your message:

pi@nexus-ag7gn:~ $ patmail.sh -h
SYNOPSIS
patmail.sh [-hv]
patmail.sh TO SUBECT TRANSPORT
patmail.sh [-d DIRECTORY] [-l FILE] [-f FILE] TO SUBECT TRANSPORT

DESCRIPTION
This script allows sending Winlink messages via the command line or script.
It requires pat (a Winlink client) and the dos2unix program.
The body of the message is supplied to the script from STDIN. See EXAMPLES below.

OPTIONS
-h, --help Print this help
-v, --version Print script information
-d, --dir=DIRECTORY Path to directory containing config.json file
and mailbox directory. Default: $HOME/.wl2k
-l FILE, --log=FILE Send pat diagnostic output to FILE. FILE will be
overwritten if it exists. To send output to stdout,
use /dev/stdout. Default: /dev/null
-f FILE, --file=FILE Attach file to message where file is full path to
file. To attach multiple files, use multiple -f FILE
arguments, one per attached file.

COMMANDS (All 3 COMMANDS are required)
TO One or more recipient email addresses
(comma separated). Winlink email addresses
(CA...@winlink.org) do not need to include
'@winlink.org', just the call sign.

SUBJECT Email subject enclosed in "double quotes".

TRANSPORT pat transport method. For example:
telnet
ax25://portname/call-ssid
where portname is as defined in /etc/ax25/axports
and the same as the ax25 port in
~/.wl2k/config.json. This is usually 'wl2k'.

where call-ssid is the RMS gateway. Example:
ax25://wl2k/W7ECG-10

Run 'pat connect help' to see more transport
types.

EXAMPLES
Send two lines of text to callsign N0...@winlink.org via telnet:

echo -e "1st line\n2nd line" | patmail.sh N0ONE "My Subject" telnet

Send the contents of file 'myfile.txt' to m...@example.com and W7...@winlink.org
via telnet:

cat myfile.txt | patmail.sh m...@example.com,W7ABC "My Important Message" telnet

Send the contents of file 'myfile.txt' to W7...@winlink.org via telnet and log
output to stdout:

cat myfile.txt | patmail.sh -l /dev/stdout m...@example.com,W7ABC "My Important Message" telnet

Send the contents of 'myfile.txt' to m...@example.com and W7...@winlink.org using
packet radio via RMS gateway ax25://wl2k/W7ECG-10

patmail.sh m...@example.com,W7ABC "My Important Message" ax25://wl2k/W7ECG-10 < myfile.txt
> --
> You received this message because you are subscribed to the Google Groups "pat-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pat-users+...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/pat-users/0e673c4e-d0f9-4210-8834-87a718e02751n%40googlegroups.com.

Rainer G

unread,
Dec 2, 2020, 12:01:24 AM12/2/20
to pat-users
Hi Clark,

it's not exactly what you are looking for, but at least related:
Chris (xylo04 at gmail) and I have extended Pat to support forms (like ICS213) in a way that is interoperable with Winlink. It's not yet merged to the main Pat repo, but I am working with Martin on that.
The main new part is a web GUI that lets the Pat user compose, view and respond to Winlink-style forms messages. The Pat server even downloads the Winlink forms library in order to stay current. There is a form picker on Pat's message composer dialog, which opens the form in a 2nd browser tab. You fill it out and click 'submit'.
There is also a limited commandline interface for authoring a form-based message "pat composeform". You pass the path to the forms template, and Pat will prompt you for a value for each form field that it finds, then it builds the XML attachment and posts the message to the outbox.
I have not tried to script the commandline input, but it should be possible.

In your usecase you already have the form field values in an XML file, so you won't need these new features, but maybe this is giving you another option for your Emcomm group.

In this thread you can find out more: https://groups.google.com/g/pat-users/c/twfX5qJZO_k

Rainer
KI7RMJ

Michael LaBlanc

unread,
Apr 8, 2021, 9:55:47 AM4/8/21
to pat-users
Rainer,

I am very interested in trying out your beta version of Pat Winlink with forms.  I have a need to generate an ICS-213 form for a communications exercise.   Will it work if I just use your Pat Winlink application version from your github repository and follow the regular Pat install instructions?

Thanks a lot for working on this critical update to the Pat Winlink application.

Kind regards,

Mike
KC2EHR

Michael LaBlanc

unread,
Apr 8, 2021, 5:33:12 PM4/8/21
to pat-users
Rainer,

Two more points:

1) Would it be possible to replace/overwrite specific files or folders on top of an operational Pat installation to get the forms functionality to work?

2) Do you need some help with the development of your branch?  I am not currently familiar with the Go language, but I have significant experience in other languages and networking.  Your goal to add forms to Pat seems really worthwhile and I am willing to assist by coming up to speed on this technology and taking on tasks that would help get this rolled out.

Kind regards,

Mike
KC2EHR

Chris Keller

unread,
Apr 9, 2021, 12:35:09 PM4/9/21
to Michael LaBlanc, pat-users
Thanks for the offer to test, and to help with development, Mike.

For testing, you can either checkout from GitHub if you're comfortable with that; the branch to follow is this one. That's probably the best way to stay up to date with the latest developments. For non-programmers, we also have some pre-built binaries available in Google Drive.

As far as further development goes, there's not a lot left that needs to happen in terms of feature completeness, but we're in code reviews to make sure it's bullet-proof and maintainable. Martin's free time has been somewhat restricted by life changes, and Rainer and I are trying to be respectful of that. Everyone is eager to see this merged into the stable project, it's just a matter of making sure it's really ready for prime time.

73, Chris, K0SWE

Wiley Sanders

unread,
Apr 9, 2021, 4:57:19 PM4/9/21
to pat-users
I am interested in figuring this out too - see my recent posting in which I cut and pasted the saved output from the check in form, which seems to have been processed  by the latest ARES Winlink Thursday exercise. The saved output from the form in the .txt file is actually JSON, which is human-readable and human-editable and *may* be independent of CRLF vs NL line ending differences (not sure about that.)

I have read that when Winlink Express sends the form data, it is in XML, but I haven't found a comprehensible explanation of when that happens (when the mail is sent by WLE?) or whether the XML data is sent in the body of the message or is attached as a MIME attachment. Pat has always handled email attachments in MIME format, compatibly all other mail user agents.

Not sure why they would want to encapsulate it in XML, which is generally hard for humans to read and modify, when JSON is an equally widely accepted data interchange format, and I think WLE can handle MIME attachments anyway. They seem hell-bent on making Winlink as complicated as possible :-). Both flmsg and WLE seem to embed forms handling in the application in in incompatible manner, which baffles me.

We've standardized on fldigi/flmsg in my area for forms interchange anyway. The barriers to entry are much less, and it is much more versatile if you dont need HF. 

Wiley KF6IIU

Jim Weisgram KJ7DMV

unread,
Apr 10, 2021, 6:25:59 AM4/10/21
to Wiley Sanders, pat-users
My understanding of the forms process on Winlink is that both the sender and the receiver have a set of form templates.

All that is transmitted is the data filled into the form, not the form structure. The receiving Winlink station uses it's local copy of the template plus the received data to assemble a filled form.

So the attached XML data is minimal. This is useful when the technology that sends the data is on the slow side.

Why XML and not JSON? My guess is the Winlink XML isn't intended to be read by humans, and I assume the XML data can be slightly smaller than JSON. I say this just by looking at the same data in both formats. Again this can be helpful when the transport is over a slow connection.

>> Jim

--
You received this message because you are subscribed to the Google Groups "pat-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pat-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages