Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
34 lines (30 sloc)
1.18 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Appends a fortune to the end of a specific signature. | |
-- | |
-- CONFIGURATION: | |
-- 1. Change the "fortune" variable to the path of your fortune program. | |
-- 2. Change the "signatureName" variable to the name of the signature to update. | |
-- 3. Change the "signatureTemplate" variable to the path to the file containing | |
-- the signature prefix content. | |
-- | |
-- INSTALLATION: | |
-- Use the AppleScript editor to compile to a .scpt file, then install someplace appropriate. | |
-- | |
-- USAGE: | |
-- You can wire the script to a key combination, using something like iKey (a | |
-- third party application). Or, you can run it as a cron job, every so often. | |
-- e.g., Once a minute: | |
-- * * * * * osascript /path/to/fortune-sig.scpt | |
set fortune to do shell script "/Users/bmc/bin/fortune" | |
set signatureName to "clapper.org" | |
set signatureTemplate to (POSIX file "/Users/bmc/.sig-preamble.clapper") | |
set sigPrefix to (read signatureTemplate as text) | |
on appIsRunning(appName) | |
tell application "System Events" to (name of processes) contains appName | |
end appIsRunning | |
if appIsRunning("Mail") then | |
tell application "Mail" | |
tell signature (signatureName as rich text) | |
set its content to sigPrefix & fortune | |
end tell | |
end tell | |
end if |