Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MailMate EagleFiler Bundle 2019

The current MailMate EagleFiler archive script works with the top-most open library, but we'd like it to work with a specific library.

add Bash Shell Script

  • Add line 10, env var to specify path to the .eflibrary file.
  • Add on line 14, an arg 3, using that var.

EagleFilerImport.scpt v2

  • Add a third _argv on line 3.
  • Add line 9 to open a POSIX path pointing at the library we want to open.

To Do

  • Store the posix path within MailMate. How? Maybe defaults write?
mkdir -p "$TMPDIR/com.freron.MailMate.EagleFiler"
cat > "${tmpfile}"
posixlibfile="/path/to/My Mail Archive.eflibrary"
osascript "${MM_BUNDLE_SUPPORT}/bin/EagleFilerImport.scpt" "${tmpfile}" "${url}" "${posixlibfile}"
# unlink "${tmpfile}" # Handled by EagleFiler
on run _argv
-- Use separate handler to avoid creating implicit properties that would modify the script file when run.
my importToEagleFiler(item 1 of _argv, item 2 of _argv, item 3 of _argv)
end run
on importToEagleFiler(_emlPath, _sourceURL, _libPath)
tell application "EagleFiler"
open POSIX file "_libPath"
-- If lots of imports are queued, this may take a while. EagleFiler would finish the import,
-- but the script would report a timeout error, anyway. So make the script wait longer.
with timeout of 10 * 60 seconds
import files {_emlPath} source URL _sourceURL with deleting afterwards
end timeout
end tell
on error _errorMessage number _errorNumber
tell application "System Events" -- Why not MailMate?
display alert "EagleFiler: " & _errorNumber message _errorMessage
end tell
end try
end importToEagleFiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.