
Care And Feeding
Introduction | Daily Maintenance | Applescript | Variable Media Info
Applescript
We've included the custom applescripts from Endnode. Feel free to take them and use them if you find anything useful.
1. startup script
(*this is the simple start up script,
it starts the whole system *)
tell application "Mailsmith 1.5" to run
tell application "printEm"
activate
end tell
tell application "CLOSEPrintEmOpenPrintEmNoCon"
activate
end tell
2. CLOSEprintEmOpenPrintEmNoCon
(* disclaimer: i'm no applescript guru.
this little script simply quits "printEm"
(which checks for a connection and starts
up another script that doesn't check after
10 minutes. this lets the system download a
bulk of email when it first starts (like in the
morning). but after it gets going it's only
downloading a few messages at a time and can
print at the same time hence, no connection check! *)
delay 600
tell application "printEm" to quit
tell application "printEmNoConnectionCheck"
activate
end tell
3. Save as text
(*this script was slightly modified from
René Brouwer's save as text script*)
on filtermessage(mymessage)
say "we have new mail" --this may be cut, haven't decided
tell application "Mailsmith 1.5"
set the_subject to subject of mymessage
set new_subject to ""
set a to contents of mymessage
(*This is needed to make sure
there are no ":" in the subject*)
repeat with i from 1 to length of the_subject
if character i of the_subject is ":" then
set new_subject to new_subject & "-"
else
set new_subject to new_subject¬
& character i of the_subject
end if
end repeat
(*change this next line to suit your
naming scheme but don't use ":"*)
set the_name to new_subject as text
if length of the_name > 31 then
set the_name to text 1 thru 30 of the_name
end if
make new text document
set contents of window 1 to a
close window 1 saving yes saving¬
in "disk:messages:" & the_name
end tell
end filtermessage
4. printEm
on idle
(* create a random number equal to number of printers
in system , 8 in this case *)
set ranNum to (random number from 1 to 8)
(* ranFolder is the name of a folder on the desktop
that holds the "Stylus C40" pref file *)
set ranFolder to "printer" & " " & ranNum
tell application "Finder"
try
set the_file to some file of folder "messages"¬
of startup disk as string
(*this is the epson pref/chooser hack, grabs the pref file
saves it to the epson sys pref folder *)
duplicate file "Stylus C40" of folder ranFolder to folder¬
"Epson Preferences" of folder "Preferences" of folder¬
"System Folder" of startup disk with replacing
end try
tell application "Mailsmith 1.5"
activate
try
(*do nothing if there is a conncection in progress ;
this is included so that mailsmith has
time to download a large amount of messages
if it needs to ie added stability *)
if connection in progress then
--sets a variable that does nothing
set did_print to false
else
--if no connection, print da bee-atch
print the_file without print dialog
end if
end try
end tell
try
activate
--tidely store the printed file away
move file the_file to folder "done" of¬
startup disk with replacing
end try
end tell
--repeat every minute
return 60
end idle
5. printEmNoConnectionCheck
(*see the comments in printEm; this script is exactly
the same except that (strangely enough) it doesn't check
for an active mailsmith connection *)
on idle
set ranNum to (random number from 1 to 8)
set ranFolder to "printer" & " " & ranNum
tell application "Finder"
try
set the_file to some file of folder "messages"¬
of startup disk as string
duplicate file "Stylus C40" of folder ranFolder to folder¬
"Epson Preferences" of folder "Preferences" of folder¬
"System Folder" of startup disk with replacing
end try
tell application "Mailsmith 1.5"
activate
try
print the_file without print dialog
end try
end tell
try
activate
move file the_file to folder "done" of¬
startup disk with replacing
end try
end tell
return 60
end idle