• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Make new mailbox with Eudora
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make new mailbox with Eudora


  • Subject: Make new mailbox with Eudora
  • From: David Crowe <email@hidden>
  • Date: Mon, 29 Aug 2005 20:44:15 -0600

Title: Make new mailbox with Eudora
I have a script that creates a mailbox in FileMaker, exports it as a text file, and then tells Eudora to open it up. The only thing I have to do with Applescript is to fix up the carriage returns.


The FileMaker script to generate a valid mailbox header is:

"From ???@??? " &
Left(DayName(Today),3) & " "  & Left(MonthName(Today),3) & " " & Day(Today) & " 08:08:08 " & Year(Today) & "
¶" & "To: " & gxContacts by ClientID::email work & "
¶" & "Subject: Report on: " & html_email_subject & "
¶" & "Date: " & Left(DayName(Today),3) & " "  & Left(MonthName(Today),3) & " " & Day(Today) & " 08:08:08 " & Year(Today) & "¶¶" &
"<x-html><!x-stuff-for-pete id=""0"">¶
<!doctype html public ""-//W3C//DTD W3 HTML//EN"">¶
<html><head>¶
<style type=""text/css""><!-- blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 } --></style>¶
<title>Report on: " & html_email_subject & "</title>¶
</head><body>" &
"<br><h3>" &
"<font size=4 color=""#FF0000"">H </font>¶
<font color=""#00FF00"">I </font>¶
<font color=""#0000FF"">G </font>¶
<font color=""#CD5C5C"">H </font>¶
<font color=""#00CED1"">L </font>¶
<font color=""#9400D3"">I </font>¶
<font color=""#DC143C"">G </font>¶" &
"<font color=""#FFD700"">H </font>¶
<font color=""#8B4513"">T </font>¶
<font color=""#BA55D3"">S </font>¶
</h3>¶<blockquote>" &
html_highlights &
"</blockquote>" &
html_all


(apologies for those who aren't familiar with FileMaker, but the "&" is the same as in AppleScript and anything not in quotes is a field name (essentially a variable). Replace "html_highlights" by valid html code.

After putting together a very long string using the above FileMaker code, I execute the following AppleScript (from within FileMaker, but it doesn't really matter):


(*
 * Take temporary text file exported by FileMaker and persuade Eudora to send it as email.
 * This involves:
 *     - Changing Vertical Tab (ASCII 11) characters to carriage returns (Bad Filemaker!)
 *     - Changing File type/creator to be a Eudora Mailbox
 *     - Telling Eudora to take the one email in the mailbox and "send again"
 *     - Delete the temporary file
 *)
property BlockSize : 512

tell application "Finder"
     try
             set AFile to (file "TempMeetingReport" of folder (path to home folder)) as alias
        on error errmsg number errnum
           error "Generate html for meeting: " & errmsg number errnum
      end try

set InputRef to (open for access AFile with write permission)
   set FileSize to (get eof of InputRef) as integer
        set FilePointer to 1
    repeat while FilePointer < FileSize
             if FilePointer + BlockSize > FileSize then
                      set n to FileSize - FilePointer
        else
                    set n to BlockSize
              end if
          set Block to (read InputRef from FilePointer to FilePointer + n)
               
                set BlockModified to false
              repeat
                  set i to offset of ASCII character 11 in Block
                  if i ¾ 0 then exit repeat
                       set BlockModified to true
                       -- Special care must be taken when ASCII 11 is first or last character on line
                  if i > 1 then
                           set BlockLeft to text 1 through (i - 1) of Block
                        else
                            set BlockLeft to ""
                     end if
                  if i < n then
                           set BlockRight to text (i + 1) through n of Block
                       else
                            set BlockRight to ""
                    end if
                  set Block to BlockLeft & return & BlockRight
                    Block
           end repeat
              if BlockModified then write Block to InputRef starting at FilePointer
          
                set FilePointer to FilePointer + n
      end repeat
     
        close access InputRef
  
        -- Take Meeting report from raw html file and queue enclosed email
     
        set file type of AFile to "TEXT"
        set creator type of AFile to "CSOm"
     tell application "Eudora"
               activate
                open {AFile}
            send again last message of mailbox "TempMeetingReport"
          close mailbox "TempMeetingReport"
       end tell
        try
             delete AFile
    end try
end tell



This will open up the new mailbox, send the email (putting it in the "Out" box, essentially) and then delete the mailbox. An alias to the mailbox hangs around until you quit Eudora (in your mail folder).

This could probably be simplified for simpler applications.

Regards,
    David Crowe
 _______________________________________________
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

  • Prev by Date: Re: A Yummy (_Not_) Bug: Gremlin is Rewriting my GUI-Scripting
  • Next by Date: iTunes weirdness..
  • Previous by thread: Re: Basic Eudora Question: Make New Mailbox
  • Next by thread: iTunes weirdness..
  • Index(es):
    • Date
    • Thread