Ok, so maybe I didn't give up quite yet... I now have the script working
as far as creating the email with the photos attached.
The only thing I can't manage is to get the new email to open and be
displayed. But that is nothing more than a minor annoyance in my book. If
anyone knows how to tell Emailer to open a particular message for
editing, speak up and we can add it to the script.
Meanwhile, the following script can now be used in place of the Mail.app
script in iPhoto to send pics via Emailer. It will take the subject and
body message from iPhoto, and attach the selected pics to a new email and
set the encoding method to Base64 (since these are flat file pics, there
is no need to save the resource fork, so I have it pre-pick Base64 for
maximum compatability.
The following is the fixed script... again, to install it, Control Click
on the iPhoto application icon and choose Show Package Contents from the
contextual menu. Then go into the Contents -> Resources -> Scripts
folder. Name the current script that is there to "Mail.scpt.old", then
drop in this new script and make sure it is named "Mail.scpt". The next
time you lauch iPhoto, it will use the new script.
---WATCH FOR LINE WRAPS---
on �event coVScliI� theObject
try
set the image_count_return to �event appScalM� "getImageCountForEmail"
set image_count to image_count_return as integer
if image_count > 0 then
set the tmp_subject to �event appScalM� "subjectForEmail"
set email_subject to tmp_subject as string
set the tmp_address to �event appScalM� "addressForEmail"
set default_address to tmp_address as string
set the new_files to {}
set the new_captions to {}
set the new_comments to {}
repeat with image_idx from 0 to (image_count - 1)
set the file_name to �event appScalM�
"getImagePathForEmail:" given
�class witQ�:image_idx
set tmp_str to file_name as string
copy tmp_str to the end of new_files
set the file_name to �event appScalM�
"getCaptionForEmail:" given
�class witQ�:image_idx
set tmp_str to file_name as string
copy tmp_str to the end of new_captions
set the file_name to �event appScalM�
"getCommentsForEmail:" given
�class witQ�:image_idx
set tmp_str to file_name as string
copy tmp_str to the end of new_comments
end repeat
set msgBody to ""
repeat with image_idx from 1 to image_count
set this_caption to item image_idx of new_captions
set this_comment to item image_idx of new_comments
set the comments to this_caption & return &
this_comment & return &
return & return
set msgBody to msgBody & comments
end repeat
set sd to path to startup disk as string
set x to count of characters in sd
set sd to characters 1 thru (x - 1) of sd as string
set msgAttach to {}
repeat with image_idx from 1 to image_count
set this_imagefile_path to mac_path(item image_idx of
new_files as
string)
set this_imagefile_path to
clean_text(this_imagefile_path)
set this_imagefile_path to sd & this_imagefile_path as
string
copy this_imagefile_path to end of msgAttach
end repeat
tell application "Claris Emailer (C)"
activate
make new outgoing message with properties
{subject:email_subject,
content:msgBody, file:msgAttach, enclosure encoding:base64}
end tell
end if
on error error_message number error_number
if the error_number is not -128 then
tell application "Finder"
activate
beep
display dialog error_message buttons {"Cancel"}
default button 1
end tell
end if
end try
end �event coVScliI�
on mac_path(unix_path)
set chars to every character of unix_path
repeat with i from 1 to length of chars
if "/" is (item i of chars as text) then
set item i of chars to ":"
end if
end repeat
return every item of chars as string
end mac_path
on clean_text(source_string)
set chars to every character of source_string
set output_string to ""
repeat with i from 1 to length of chars
set n to ASCII number (item i of chars)
set output_string to output_string & (ASCII character n)
end repeat
return output_string
end clean_text
property ASDScriptUniqueIdentifier : "Mail.applescript"
---END OF SCRIPT---
-chris
<http://www.mythtech.net>
___________________________________________________________________________
To unsubscribe send a mail message with a SUBJECT line of "unsubscribe" to
<[EMAIL PROTECTED]> or <[EMAIL PROTECTED]>