On Thu, Dec 04, 2003, the following words from PowerMail Engineering
[EMAIL PROTECTED], emerged from a plethora of SPAM ...
>Mikael Byström wrote:
>
>>As the "file" property of "attachments" is read only, does this mean it's
>>impossible under OS X to update the path for the attachment if I have it
>>moved by scripting the finder executed by a filter?
>
>If you move an attachment to a different location by any mean, PowerMail
>will loose it's path. And you can't currently change the attachment path
>of an existing message by AppleScript. This may change in a future
>version, thought.
>
>>by the way, how do I assign the "attachment folder" path to a variable?
>>When I try with 'set varFolder to "attachment folder" of application' I
>>get "Can't get "attachment folder" of application.
>
>'set varFolder to attachment folder' should work
>
I've only found a clumsy method to retain the file path of the
attachments received within PowerMail. But hopefully this will be helpful
since PM lacks the ability to allow simple management of the files
received with email.
1. Move the attached file where you want it.
2. Create a file URL of the attachment you moved, such as:
<file:///Users/me/Documents/QuicKeys%20X%20FAQ.rtf> file
<file:///Users/me/Documents/> use folder if several files received in
the message.
(replace spaces in the file path with "%20")
3. Modify the content of the message with an AppleScript.
a. Copy the file URL from step 2 to the clipboard.
b. Select the text of the message you want to keep.
c. Append the message content to the file URL on the clipboard using
script A below.
d. Replace the message content using script B below to include the file URL.
e. Now the file or folder can be double-clicked/command-clicked to open
from within the message.
The scripts below are examples because I created them hurriedly just to
get the job done - obviously they can be modified to allow more
flexibility and customization as needed. Both scripts can be used from
the system script menu in X. I assume they will also work from the PM
script menu. Not tested for OS 9 because I don't use PowerMail in OS 9. I
still think it's easier to work with old messages and attachments from a
FileMaker Pro database, because I may decide at a later date to move the
attachment again or I might even use a different email client.
<Begin AppleScript A>
to getClipBTxt()
set the clipStuff to the clipboard as text
return (the clipStuff)
end getClipBTxt
to alterClipB(alteredClip)
set the clipboard to the alteredClip
beep
end alterClipB
tell application "PowerMail"
-- begin one line
if (exists (the displayed message of the front window)) and ¬
(exists (the selection of the front window)) then
-- end
set the selectedTxt to the selection of the front window
set prevClip to my getClipBTxt()
set alteredClip to (the prevClip & return & the selectedTxt)
my alterClipB(alteredClip)
else
say "Unable to comply. Open message and selected text required."
end if
end tell
<End AppleScript A>
<Begin AppleScript B>
property clipStuff : ""
to replaceMsgContent(targetMsg)
tell application "PowerMail"
close the front window
set content of the targetMsg to the clipStuff
open the targetMsg
end tell
end replaceMsgContent
set the clipStuff to the clipboard as text
tell application "PowerMail"
if exists the displayed message of the front window then
set the targetMsg to the displayed message of the front window
my replaceMsgContent(targetMsg)
else
say "Unable to comply. Open message required."
end if
end tell
set the clipStuff to ""
<End AppleScript B>
HTH
cheshirekat
--
Sometimes even to live is an act of courage.
- Lucius Annaeus Seneca, writer and philosopher
* 867 PowerBook G4 * OS X 10.2.6 * 768 MB Ram *