home *** CD-ROM | disk | FTP | other *** search
/ ftp.qualcomm.com / 2014.06.ftp.qualcomm.com.tar / ftp.qualcomm.com / eudora / eudorapro / mac / extras / scripting / Eudora_and_AppleScript.txt < prev    next >
Text File  |  1999-09-19  |  9KB  |  217 lines

  1.                     Eudora and AppleScript Handbook
  2.                             by Scott Gruby
  3.                            Revision 1.0
  4.                         ⌐1995 QUALCOMM, Inc.
  5.                       
  6.  
  7. Introduction
  8. -------------------
  9. Eudora's has the ability to be scripted such that repetitive tasks can be automated using AppleScript. Many, but not all, of Eudora's functions can be accessed allowing the user to create messages, check mail, as well as change settings from simple scripts.
  10.  
  11. Note: This document assumes the user is using Eudora 1.5.1 or Eudora 2.1.1 or higher. Previous versions handled scripting differently.
  12.  
  13. AppleScript Dictionary
  14. --------------------------
  15. The commands that Eudora uses from AppleScript are documented in Eudora's AppleScript Dictionary; use the Script Editor to Open Dictionary and then choose Eudora. The commands will be listed as well as the parameters that they accept.
  16.  
  17. Standard Commands
  18. --------------------
  19. The simplest commands allow the user to create a new message, enter text (or extract text from a message), check for new mail, as well as message manipulations (transfer, forward, reply, etc.).
  20.  
  21. The basic structure for AppleScript commands is:
  22.  
  23. tell application "Eudora"
  24.     <enter commands here>
  25. end tell
  26.  
  27.  
  28. **************************************************
  29. General Commands
  30. **************************************************
  31. A script can tell Eudora to connect to the POP or SMTP server using the command:
  32.     connect
  33.     
  34.     If no options are specified, the defaults from the Settings are used.
  35.     The options are: with sending (without sending) which sends queued messages,
  36.     with checking (without checking) which checks for mail, and with waiting
  37.     (without waiting) which waits until Eudora is idle before connecting.
  38.  
  39. If you want to launch Eudora from a script, you must have the Scriptable Finder (included with System 7.5 and System 7 Pro). You would use the following syntax:
  40.  
  41. tell application "Finder"
  42.     open {"Macintosh HD:Eudora Folder:Eudora" as alias}
  43. end tell
  44.  
  45. If you want to open a particular settings file, the syntax would be identical, but you would substitute in the name and location of your settings file in the above example.
  46.  
  47. **************************************************
  48. Individual Message Commands (outgoing messages)
  49. **************************************************
  50. The following illustrates the syntax for create a new message and entering data:
  51.  
  52. tell application "Eudora"
  53.     -- Create a new message in the out box
  54.     make message at end of mailbox "out"
  55.  
  56.     -- Message 0 indicates the current message
  57.     -- Set the recipient of the message
  58.     set field "to" of message 0 to "username@hostname.com"
  59.     
  60.     -- Set who the message is from;
  61.     -- This must be set to a valid address so that you can receive replies 
  62.     set field "from" of message 0 to "myname@hostname.com"
  63.     
  64.     -- set the subject of the message
  65.     set field "subject" of message 0 to "The Subject"
  66.  
  67.     -- set the cc recipients of the message
  68.     set field "cc" of message 0 to "cc@hostname.com"
  69.  
  70.     -- set the bcc recipients of the message
  71.     set field "bcc" of message 0 to "bcc@hostname.com"
  72.     
  73.     -- set the body of the message
  74.     -- field "" indicates the body of the message
  75.     set field "" of message 0 to "This is the body of the message."
  76.     -- Note: you can also use   set body of message 0 to "This is the body."
  77. end tell
  78.  
  79.  
  80. The options, such as attachment encoding type, which signature to use, quoted printable, etc. (the items on the icon bar), can be set via AppleScript.
  81.  
  82. The syntax is as follows:
  83.  
  84.     -- No Signature
  85.     set signature of message 0 to none
  86.     
  87.     -- Regular Signature
  88.     set signature of message 0 to standard
  89.     
  90.     -- Alternate Signature (Eudora 2.1)
  91.     set signature of message 0 to alternate 
  92.     
  93.     -- Use quoted printable encoding
  94.     set QP of message 0 to true 
  95.     
  96.     -- Request a return receipt on the message
  97.     set return receipt of message 0 to true 
  98.     
  99.     -- Wrap the text when it is sent
  100.     set wrap of message 0 to true
  101.     
  102.     -- Tab expansion...tabs should be expanded to spaces
  103.     set tab expansion of message 0 to true
  104.     
  105.     -- Keep a copy of the message after it is sent
  106.     set keep copy of message 0 to true
  107.     
  108.     -- Macintosh Info should be sent with attachments
  109.     set preserve macintosh info of message 0 to true
  110.     
  111.     -- Specify the attachment encoding...can be AppleDouble, AppleSingle, BinHex
  112.     -- or uuencode (Eudora 2.1)
  113.     set attachment encoding of message 0 to BinHex
  114.     
  115.     -- Set the priority of a message
  116.     -- 0=Standard, 1=Highest, 120=High, 160=Low, 180=Lowest
  117.     set priority of message 0 to 1
  118.     
  119.     
  120. In order to attach documents to a message via AppleScript, you must have the full path name of the file(s) to attach. Use the following format:
  121.  
  122.     -- Attach file called "Macintosh HD:myFile" to current message
  123.     set theName to "Macintosh HD: myFile"
  124.     attach to message 0 documents {theName}
  125.     
  126. You can attach several files to a message either by issuing multiple attach commands or specifying more than one filename in the {theName} section as follows:
  127.  
  128.     set theName to "Macintosh HD:myFile1"
  129.     set theName2 to "Macintosh HD:myFile2"
  130.     attach to message 0 documents {theName, theName2}
  131.  
  132. The message can then be queued with the command:
  133.     queue message 0
  134.     
  135.  
  136. **************************************************
  137. Individual Message Commands (incoming messages)
  138. **************************************************
  139. With incoming messages, you can use many of the same types of commands as with the outgoing messages, but you can only get information, i.e. to get the subject of the message, you would use:
  140.  
  141.     get field "subject" of message 0
  142.     
  143.     -or-
  144.     
  145.     set myField to field "subject" of message 0
  146.  
  147.     This can be done for the following fields: "to", "cc", "from", "subject", "" (body), and priority.
  148.  
  149.     In addition you, can show all the header information (the Blah, Blah, Blah button) using:
  150.  
  151.     set show all headers of message 0 to true
  152.     
  153.     
  154. Messages can be forwarded, redirected, replied to, or transferred to a specific mailbox. Here's the syntax:
  155.  
  156.     -- Forwards a message quoting the entire message;
  157.     -- A new message is created without a recipient
  158.     forward message 0
  159.     
  160.     -- Redirects a message
  161.     -- A new message is created without a recipient
  162.     redirect message 0
  163.     
  164.     -- Replies to a message
  165.     -- If you don't specify additional options, the default options
  166.     -- (i.e. reply to all, etc.) will be used. The additional options
  167.     -- are: with quoting (without quoting), with everyone (without
  168.     -- everyone), and with self (without self).
  169.  
  170.     reply message 0 with quoting
  171.  
  172.  
  173. **************************************************
  174. Changing Settings
  175. **************************************************
  176. You can change many of Eudora's settings via a script. In order to do so, you must know the number of the setting you want to change. This information can be found in the Eudora Q&A stack which is location at:
  177.  
  178. <ftp://ftp.qualcomm.com/eudora/eudorapro/mac/extras/EudoraQA.sea>
  179.  
  180. The general format for changing a setting is:
  181.     set setting 3 to "popuser@hostname.com"
  182.     
  183. Some common settings are:
  184.  3  POP Account
  185.  4  SMTP Server
  186.  5  Return address
  187.  6  Mail check interval
  188. 23  Ph Server
  189. 24  Save Password?
  190. 31  Password (if Save Password is on)
  191. 61  Dialup username
  192. 62  Dialup password (if Save Password is on)
  193. 77  Real name
  194. 84  Offline?
  195.  
  196.  
  197. **********************************************************************
  198. Notification (telling Eudora to notify some other program or script)
  199. **********************************************************************
  200. Eudora allows you the ability to notify an AppleScript when certain actions occur.
  201. For example, you can have it notify your paging application that new mail has arrived so that you are paged.
  202.  
  203. You should not use the notification events from a script run from the Script Editor; this will cause Eudora to notify the Script Editor and not your script. Your script should be saved as an application and then it can be properly notified. In order to simplify the using notification, you should obtain the Notify-Kit which can be found at:
  204.  
  205. <ftp://ftp.eudora.com/eudora/eudorapro/mac/extras/scripting/notify-kit.hqx>
  206.  
  207. This kit has scripts in it that allow you to drop your script onto them and either start or stop the notification. It also contains a sample script on what types of notifications are available, i.e. notify when mail is sent, mail arrives, is about to connect, or has finished connecting.
  208.  
  209. **********************************************************************
  210. More Help?
  211. **********************************************************************
  212. If you need more help about scripting, you can join the Mac Scripting mailing list by sending email to: LISTSERV@DARTCMS1.DARTMOUTH.EDU with no subject line and the body of your message as follows:  SUB MACSCRPT Your Name. If you want to remove yourself from the list, send email to the same address with the body as follows: SIGNOFF MACSCRPT
  213.  
  214. If you are a user of the commercial version of Eudora, you can contact technical support for further assistance. Freeware users should consult various newsgroup that discuss scripting or use the mailing list indicated above.
  215.  
  216.  
  217.