On 9/12/02 09:54 Michelle Steiner Wrote:

>You have to put the text of the script in the message; the list does 
>not handle attachments.
>
>--Michelle

Sorry Michelle, I knew but had forgotten this. So here it is, the heading 
followed by the text of the script. 

Asaad
========================================
Emailer Messages move to ClarisWorks 5.0

This script will take messages you have selected in Emailers Browser 
window and move them to ClarisWorks. If there is an open text document in 
ClarisWorks, it will past the messages at the insertion point, if not it 
will make a new text document.

Note: The script will insert tabs after the headers ("To:" etc.), so you 
are best off preparing some makro in ClarisWorks which sets a ruler with 
a tab on the text (or applyes a user style). If you do a ClarisWorks 
makro for this, then you can paste the name of that makro into the 
script. (I was to lazy to find out how to do this in straight 
AppleScript.)

� 1998 (Freeware, but not public domain!) Author: Sascha Welter, 
<[EMAIL PROTECTED]>

=============================================================
set allTheMessages to GetSelectedMessages("message", false)
-- handler for David Cortrights script "GetSelectedMessages v2", see below

if allTheMessages is {} then return

if (count of allTheMessages) � 2 then
        tell application "Claris Emailer"
                set theFirstDate to time sent of item 1 of allTheMessages
                set theLastDate to time sent of the last item of allTheMessages
        end tell
        
        if theFirstDate < theLastDate then
                (* reverse order to get the newest message on top
                        if you want to get the oldest message on top, 
                        then you put  "--" in front of the above line to comment it 
out and
                        remove the comment signs from the below line *)
                -- if theFirstDate > theLastDate then
                set allTheMessages to reverse of allTheMessages
        end if
        
end if


tell application "AppleWorks"
        activate
        try
                if (the document kind of document 1 is not WP) then
                        set theDocument to (make new document at beginning with 
properties 
{document kind:WP})
                else
                        set theDocument to document of window 1
                end if
        on error theErrorMessage
                if theErrorMessage is "ClarisWorks got an error: Can't get document 
kind of document 1. Invalid index." then
                        set theDocument to (make new document at beginning with 
properties 
{document kind:WP})
                else
                        display dialog "The script did not expect this error: " & 
theErrorMessage
                        return
                end if
        end try
        
end tell

repeat with fred in allTheMessages
        
        tell application "Claris Emailer"
                
                set theSender to the sender of fred
                set eAdress to (address of theSender)
                set eName to display name of theSender
                set theSub to the subject of fred
                
                if the class of fred is incoming message then
                        set theTimeRec to the time received of fred
                else
                        set theTimeRec to ""
                end if
                set theTimeSent to the time sent of fred
                
                
                set therecipients to (every recipient of fred)
                set allRecipients to ""
                
                repeat with barnie in therecipients
                        set zumteufel to (address of barnie)
                        set wohindenn to (address of zumteufel)
                        set werdenn to (display name of zumteufel)
                        
                        set allRecipients to (allRecipients & werdenn & ", " & 
wohindenn & 
return & tab) as string
                end repeat
                
                set theContent to the content of fred
                set theMessage to "Subject:" & tab & theSub & return & "Date sent: " & 
tab & theTimeSent & return & �
                        "Date Rec.: " & tab & theTimeRec & return & "From: " & tab & 
eName & 
", " & �
                        eAdress & return & "To:" & tab & allRecipients & return & 
return & 
theContent
        end tell
        
        set theText to theMessage & return & "-------------------------------" & 
return & return
        
        tell application "AppleWorks"
                set selection of theDocument to theText
        end tell
        
end repeat

(*      uncomment this and insert the name of your "apply proper style&tab" 
makro here
tell application "ClarisWorks"
        do script "Emailer Message Format"
end tell
*)

beep 3 -- done!



(* GetSelectedMessages v2
** by David Cortright <[EMAIL PROTECTED]>
** classFilter: the class of message this script processes
**                   "incoming message", "outgoing message", or "message"
** fProcessOpenMessages: a flag indicating whether or not to process an 
open message
**                                      true or false
** returns a list of messages of the specified class or {} if there are 
no messages of the specified class
*)
on GetSelectedMessages(classFilter, fProcessAnOpenMessage)
        tell application "Claris Emailer"
                if classFilter is "incoming message" then
                        set messageClass to incoming message
                else if classFilter is "outgoing message" then
                        set messageClass to outgoing message
                else
                        set messageClass to message
                        set classFilter to "message"
                end if
                
                try
                        set messagesOfUnknownClass to {the filtered message}
                        
                on error
                        if the class of the front window is browser window then
                                set messagesOfUnknownClass to the selection of the 
front window
                                
                        else if the class of the front window is incoming message 
window or �
                                the class of the front window is outgoing message 
window then
                                if fProcessAnOpenMessage is true then
                                        try
                                                set messagesOfUnknownClass to {the 
displayed message of the front 
window}
                                        on error
                                                try
                                                        set the subject of the 
displayed message of the front window to �
                                                                (get the subject of 
the displayed message of the front window)
                                                        select menu item "Save" of 
menu "File"
                                                        set messagesOfUnknownClass to 
{the displayed message of the front 
window}
                                                end try
                                        end try
                                else
                                        set messagesOfUnknownClass to {}
                                end if
                        end if
                end try
                
                if messageClass is message then
                        set selectedMessages to messagesOfUnknownClass
                        
                else
                        set selectedMessages to {}
                        repeat with theMessage in messagesOfUnknownClass
                                if the class of theMessage is messageClass then
                                        set selectedMessages to selectedMessages & 
theMessage
                                end if
                        end repeat
                end if
        end tell
        
        if selectedMessages is {} then
                if fProcessAnOpenMessage is true then
                        set singleMessageAddendum to "or have one open in its own 
window "
                else
                        set singleMessageAddendum to ""
                end if
                tell me to display dialog "You need to select at least one " & 
classFilter & " in the Browser " & �
                        singleMessageAddendum & "in order to use this script." buttons 
{"OK"} 
default button "OK" with icon note
        end if
        
        return selectedMessages
end GetSelectedMessages
=========================

___________________________________________________________________________
To unsubscribe send a mail message with a SUBJECT line of "unsubscribe" to
<[EMAIL PROTECTED]>  or  <[EMAIL PROTECTED]>

Reply via email to