• MacTech Network:
  • Tech Support
  • |
  • MacForge.net
  • |
  • Apple News
  • |
  • Register Domains
  • |
  • SSL Certificates
  • |
  • iPod Deals
  • |
  • Mac Deals
  • |
  • Mac Book Shelf

MAC TECH

  • Home
  • Magazine
    • About MacTech in Print
    • Issue Table of Contents
    • Subscribe
    • Risk Free Sample
    • Back Issues
    • MacTech DVD
  • Archives
    • MacTech Print Archives
    • MacMod
    • MacTutor
    • FrameWorks
    • develop
  • Forums
  • News
    • MacTech News
    • MacTech Blog
    • MacTech Reviews and KoolTools
    • Whitepapers, Screencasts, Videos and Books
    • News Scanner
    • Rumors Scanner
    • Documentation Scanner
    • Submit News or PR
    • MacTech News List
  • Store
  • Apple Expo
    • by Category
    • by Company
    • by Product
  • Job Board
  • Editorial
    • Submit News or PR
    • Writer's Kit
    • Editorial Staff
    • Editorial Calendar
  • Advertising
    • Benefits of MacTech
    • Mechanicals and Submission
    • Dates and Deadlines
    • Submit Apple Expo Entry
  • User
    • Register for Ongoing Raffles
    • Register new user
    • Edit User Settings
    • Logout
  • Contact
    • Customer Service
    • Webmaster Feedback
    • Submit News or PR
    • Suggest an article
  • Connect Tools
    • MacTech Live Podcast
    • RSS Feeds
    • Twitter

Moving from Microsoft Office VBA to AppleScript:
MacTech's Guide to Making the Transition

Introduction  |  Table of Contents

Page Prev and Page Next buttons at bottom of the page.

Would you like a hard copy
or PDF of this Guide?

You can get a hard copy sent to you
AND download a PDF now ($19.95)
, or

... just download a PDF ($9.95).

Either way, you get a complimentary
MacTech Magazine Subscription

courtesy of the
Microsoft Mac Business Unit


 

  Magazine Reg. Price:  $50.00 value  
  Guide Reg. Price:  $40.00 value  
  You Save:  over $80.00!  

April, 2007
Page 115



The scripts made by the current Script Editor are now Data Fork-only files. The Entourage 2004 script menu can run these, but it does not retain changes in script property values when the script ends. (The old Resource Fork scripts were replaced in Script Editor 2, released with Panther OS 10.3. But Microsoft Office 2004 still has to work in Jaguar OS 10.2.8 which was still quite prevalent when Office 2004 came out and could not adopt the new Panther APIs for script menus.) This issue is expected to disappear with Entourage 2008, where it is assumed that the modern script menu APIs will be adopted, so that changes made to script property values in running Data Fork scripts as made by Script Editor will be retained.

So if you write a script that uses script properties whose values can be altered by script, as one or two of the examples below do, you have three choices: either

1) run it from the system script menu, just as you do for your Word and Excel scripts, and manage without keyboard shortcuts, or

2) if you have Script Debugger you can still save the scripts in Resource Fork format.

3) Download Mac MVP Barry Wainwright's "Convert Script", which will convert your data-fork script into a resource-fork script using a Unix shell script. You just drop your script on it and it's converted. Here's the URL: <http://www.barryw.net/scripts/index.html>

(None of these issues apply if you save your script as an Application to be run externally.)

To run scripts from Entourage's script menu, which looks just like the system one but is on the left side of the menu bar just to the right of the Help menu, put your scripts here: ~/Documents/Microsoft User Data/Entourage Script Menu Items/ folder (where ~/ means your user folder). They then appear as menu items in the Entourage script menu.

Email: Reply with Insertion Reversed

Here's a script that lets you flip your Reply style and signature placement from top to bottom, or vice-versa, on a per-message basis. I use it several times a day myself. People send you email replies where they may reply at the top, or may reply at the bottom. Nothing is messier than a chain of replies where the writers switch from one to the other, ruining the continuity. But in the meantime you have chosen your preferred method in the Entourage preferences – you can't flip-flop the preferences continually. So, if you want to sometimes reply in the opposite manner to your regular preference, just run this script.

But, first you have to set it up. This is done by setting the properties at the top. Don't worry – you will be able to do so. In the version of this script available at <http://macscripter.net> you set these properties by running a separate PREFS script, which uses the standard scripting addition commands load script and store script to change the values of the properties in the main script.

However: a) that won't work (in Entourage 2004) with your scripts made by Script Editor (see above) – the copies at macscripter.net are resource-fork scripts made in Script Debugger and b) you're a scripter, not a regular user, so you can just set the properties how you like in Script Editor, and they will work. (If you ever want to change them in the future, just open the script in Script Editor, change them, and save.)

You can add a keyboard shortcut to the script name, which is particularly handy for this script, and put it in the Entourage script menu. Here are the four properties to go at the top of the script:

 

property replyUsingMessageFormat : true

property htmlText : true

property attributionStyle : "short headers" -- or "internet" or "none"

property insertionPointOnTop : false --(only applies to internet-style)

 

The first two properties, replyUsingMessageFormat and htmlText, are for indicating whether you want to reply in the same format (i.e., Plain Text or HTML) as the original message, or whether you always want to reply in one or the other. This should be the same as you set it in the Entourage "Compose" preferences: AppleScript cannot access those preferences so you need to set them here.

If you set replyUsingMessageFormat to true, then also set htmlText to true. If you set replyUsingMessageFormat to false, set htmlText to whichever you want (false if you want Plain Text always). If your usual attribution style in the Entourage Reply Preferences is to "Place reply [quoted] text at top of message and use this attribution line" (i.e., reply at bottom) and for the script you want the opposite format of "Place reply at top of message and include From, Date, To and Subject lines" (i.e., reply at top with signature at top), set attributionStyle to "short headers".

On the other hand, if your usual attribution style is "Place reply at top of message and include From, Date, To and Subject lines" (i.e., reply at top), to do the opposite in the script set attributionStyle to "internet". (Or to "none", if that's what you want for the script.) In the second case – attributionStyle set to "internet" – you can also choose whether to set insertionPointOnTop to true (which means you'd be replying at the top: this is the way to get both the "internet" attribution plus reply-at-top, but it still places the signature at the very bottom, so is probably not what you want) or false (so reply at bottom). Naturally whatever text comes after the double-dashes ( -- ) is just comment and not code.

Here is the whole script when compiled, with the default property values chosen:

property replyUsingMessageFormat : true

property htmlText : true

property attributionStyle : "short headers"

-- or "internet" or "none"

property insertionPointOnTop : false

-- (only applies to internet-style attribution)

 

tell application "Microsoft Entourage"



< Previous Page Next Page>
 
MacTech Only Search:
Community Search:

 
 
 

 
 
 
 
 
  • SPREAD THE WORD:
  • Slashdot
  • Digg
  • Del.icio.us
  • Reddit
  • Newsvine
  • Generate a short URL for this page:



MacTech Magazine. www.mactech.com
Toll Free 877-MACTECH, Outside US/Canada: 805-494-9797
MacTech is a registered trademark of Xplain Corporation. Xplain, "The journal of Apple technology", Apple Expo, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, Apple Expo, MacTech Central, MacTech Domains, MacNews, MacForge, and the MacTutorMan are trademarks or service marks of Xplain Corporation. Sprocket is a registered trademark of eSprocket Corporation. Other trademarks and copyrights appearing in this printing or software remain the property of their respective holders.
All contents are Copyright 1984-2010 by Xplain Corporation. All rights reserved. Theme designed by Icreon.
 
Nov. 20: Take Control of Syncing Data in Sow Leopard' released
Nov. 19: Cocktail 4.5 (Leopard Edition) released
Nov. 19: macProVideo offers new Cubase tutorials
Nov. 18: S Stardom anounces Safe Capsule, a companion piece for Apple's
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live