scripting print
scripting print
- Subject: scripting print
- From: Christian Vinaa <email@hidden>
- Date: Sun, 6 Mar 2005 19:24:09 +0100
just FYI ( someone might get idea from this ? )
here something I've dabbled with this sunday
it takes the script from http://www.apple.com/applescript/print/
and extends it;
using Eudora / taking receivers emailaddress from
the apple-works document that gets printed /
inserts some pdf files as attached
***
on open these_items
try
set this_file to item 1 of these_items
tell application "Finder"
set the file_name to the name of this_file
set the parent_folder to
(the container of this_file) as alias
end tell
tell application (path to frontmost application as string)
try
if (count of
characters of word -2 of paragraph 2 of front
document) = 7 then
set
journalNumber to word -2 of paragraph 2 of front
document as text
end if
end try
try
if word 1 of
paragraph 6 of front document = "Email" then
set
emailAddress to words -3 through -1 of paragraph
6 of front document as text
end if
end try
set frontDocName1 to name of front document as text
set frontDocName to
characters 1 through -12 of frontDocName1 as text
repeat
--display dialog
"Enter a name for file:" default answer
frontDocName & ".pdf"
--set this_name
to the text returned of the result
set this_name to frontDocName & ".pdf"
if this_name is not "" then exit repeat
end repeat
end tell
tell application "Finder"
set the name of this_file to this_name
set the target_file to ¬
(document file
this_name of the parent_folder) as alias
set emailPolPdf to file
"y" of folder "x" of folder "x" of ¬
folder "x" of
folder "x" of folder "Desktop" of folder "x" of ¬
folder "Users" of startup disk as alias
end tell
tell application "Eudora"
set newMessage to make
new message at end of mailbox "Out"
attach to newMessage documents {target_file}
attach to newMessage documents {emailPolPdf}
set field "to" of message newMessage to emailAddress
set field "subject" of
message newMessage to journalNumber & " // "
set body of newMessage to ""
set thePers to "x"
set personality of newMessage to personality thePers
end tell
on error error_message number error_number
if the error_number is not -128 then
tell application (path to
frontmost application as string)
display dialog
error_message buttons {"OK"} default button 1
end tell
else
tell application "Finder" to delete parent_folder
end if
end try
end open
***
--
Christian Vinaa
...... Meanwhile, aunt Martha, having taken a tramp in the woods,
is lying in a ditch at the edge of town .........................
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden