-- Eudora-GPG-Sign-Encrypt version 0.008 -- Richard Chang -- Read the Notes file. Use at your own risk. -- If you make money with this, give me some. Otherwise free. -- -- Version .005: -- 1. New: combined Eudora-GPG-Sign and Eudora-GPG-Encrypt -- Version .006 -- Figured out how to make new folder in "Temporary Items" -- Version .007 -- 1. More error checking for 0 length messages and files. -- Version .008 -- 1. Moved common functions into a shared file set CR to ASCII character 13 set LF to ASCII character 10 set WrapLength to 76 -- Load library tell application "Finder" set EudoraScriptsFolder to folder "Contents:MacOS:Eudora Stuff:Scripts:" of (path to me) set LibFile to file "Eudora-GPG Stuff:Eudora-GPG-Lib" of EudoraScriptsFolder end tell set EGPGLib to load script file (LibFile as string) tell EGPGLib to set {theFolder, QuotedUnixDir} to MakeTempFolder() -- Get body of current message tell application "Eudora" to set OriginalMesg to body of message 0 if length of OriginalMesg = 0 then display dialog "Empty message body! No processing done." buttons {"OK"} default button "OK" return end if tell EGPGLib to WriteUnixFile(theFolder & "mesg", OriginalMesg) -- get name of recipient try tell EGPGLib to set recipient to GetRecipient() on error display dialog "Never mind. Your message was not altered." buttons {"OK"} default button "OK" tell EGPGLib to CleanUp(theFolder, "mesg") return end try -- get GPG passphrase try set passphrase to askPassword "GPG Passphrase" on error display dialog "Never Mind" buttons {"OK"} default button "OK" tell EGPGLib to CleanUp(theFolder, "mesg") return end try -- set up GPG command and execute it via "do shell script" command set CleanUpFiles to "mesg output mesg.asc" set doGPG to "cd " & QuotedUnixDir & "; echo '" & passphrase & "' " & Â "| /usr/local/bin/gpg -s --passphrase-fd 0 -a -e -r '" & recipient & "' -q --batch mesg >& output" try do shell script doGPG on error tell EGPGLib to set ErrorMesg to ReadUnixFile(theFolder & "output") display dialog "Could not encrypt the message. GPG Output:" & CR & CR & ErrorMesg tell EGPGLib to CleanUp(theFolder, CleanUpFiles) return end try set EncryptedFile to theFolder & "mesg.asc" tell application "Finder" if (file EncryptedFile exists) then tell EGPGLib to set EncryptedMesg to ReadUnixFile(EncryptedFile) tell application "Eudora" to set (body of message 0) to EncryptedMesg else tell application "Eudora" to display dialog "File disappeared: " & EncryptedFile end if end tell tell EGPGLib to CleanUp(theFolder, CleanUpFiles) return