Code: Select all
#! /bin/bash
yad --no-buttons --on-top --title="Email" --geometry='300x50+80+1200' --form --field="Save":fbtn /root/mail.sh
The button (code above) is useful to have on the desktop . . . whilst using mail.sh (code below).
Code: Select all
#! /bin/bash
# manually with mouse highlight thunderbird email date
# 06/11/15 13:21
# example equates to November 6th 2015 at 1:21 pm
# run this script (from button or menu item)
xdotool search --classname Mail windowactivate
dialog=$(yad --on-top --mouse --width=800 --title "Copy and Paste <From (To) Field>" --form --field="")
ret=$?
if [[ $ret -eq 1 ]];then exit 0;fi
from=$(echo $dialog | awk 'BEGIN {FS="|" } { print $1 }')
if [[ $from = "" ]]; then exit 0; fi
dialog=$(yad --on-top --mouse --width=600 --title "Highlight <Date Time Field>" --text="Then Click OK")
xdotool key "ctrl+c";
xdotool search --classname Mail windowactivate
sleep 0.5
xdotool key "ctrl+s";
sleep 0.5
xdotool key "Home";
# load clipboard into variable using xclip
var1=$(xclip -out -selection c)
# replace slashes and spaces with hyphens
# 06-11-15-13:21
# swap chars 1 + 7
# swap chars 2 + 8
# 15-11-06-13:21
var2=$(echo $var1 | sed 's/\//-/g' | sed 's/ /-/g' | awk '{print substr($0,7,2) substr($0,3,4) substr($0,1,2) substr($0,9,6)}')
# append - prepend 20
var3="20"$var2"-"
# 2015-11-06-13:21-
echo $var3$from | xclip -selection c
xdotool key "ctrl+v";
# then yad text input "from field" append sender details
Emails are saved as timestamped .eml files which will open in Thunderbird.
I create timestamped folders manually for saved attachments.