MacTech Network:   MacForge.net  |  Computer Memory  |  Register Domains  |  Printer Supplies  |  Cables  |  iPod Deals  |  Mac Deals  |  Mac Book Shelf


  MacTech Magazine

The journal of Macintosh technology

 
 
MacRentals

Magazine In Print
  About MacTech  
  Home Page  
  Subscribe  
  Archives DVD  
  Submit News  
  Submit a Tip!  
  Get a copy of MacTech RISK FREE  
Google
Entire Web
mactech.com
Mac Community
More...
MacTech Central
  by Category  
  by Company  
  by Product  
MacTech News
  MacTech News  
  Previous News  
  MacTech RSS  
Article Archives
  Show Indices  
  by Volume  
  by Author  
  Source Code FTP  
Inside MacTech
  Writer's Kit  
  Editorial Staff  
  Editorial Calendar  
  Back Issues  
  Advertising  
Contact Us
  Customer Service  
  MacTech Store  
  Legal/Disclaimers  
  Webmaster Feedback  

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 6



Unlike Entourage, which has had its own script menu from its inception, Word, Excel and PowerPoint 2004 do not have their own script menus. (It‘s always possible that the next version might introduce these, which would allow for keyboard shortcuts such as Entourage does.)

But the OS has its own script menu. To enable it, in Tiger OS 10.4 go to /Applications/AppleScript/AppleScript Utility and double-click it. Click "Show scripts menu in menu bar" checkbox and close. (In Panther OS 10.3, go to /Applications/AppleScript/Script Menu.menu and double-click it.) Now you will see a black "squiggly-S" icon on the right-hand side of the main menu bar, near the menu clock:

^ System Script Menu

Click the menu, then Open Scripts Folder/Open User Scripts Folder (in Panther, there is no sub-item). This creates and opens a "Scripts" folder here: ~/Library/Scripts/, where ~/ means your username Home folder (Mac HD/Users/username/). This is where you will store your scripts to make them appear in the same menu – you just select a script name in the menu and it runs.

If the menu starts to get too long for comfort, and you‘d like to see some or all of your Word scripts, say, only when Word is in the front, make an "Applications" subfolder inside this Scripts folder, and then a "Microsoft Word" (and a separate "Microsoft Excel" and "Microsoft PowerPoint" and whichever other applications you‘d like to do the same for) subfolder inside the "Applications" folder. You must spell out the full name of the application exactly as it appears on your computer or it won‘t make the match to the application. You can do all this automatically in OS 10.4 (and later, presumably) by bring Word or any application to the front, clicking the Script menu, and choose Open Scripts Folder/Open Microsoft Word Scripts Folder: this creates the folder if it does not yet exist. Now any scripts saved in the Microsoft Word subfolder will be seen in the Scripts menu only when Word is the active application in the front. (So don‘t put scripts in there that you want to call from another application or the Finder to get Word going.)

This is one great advantage AppleScript has over VBA: You can call a Word script from, say, Entourage or FileMaker Pro, to take some selected text, for example, and use it in a Word document, perhaps even doing it all automatically in the background. It is certainly a limitation that you cannot call scripts from a button on a Word toolbar nor (yet) from a keyboard shortcut (at least not without a third-party utility such as iKey, DragThing or QuicKeys: see the Resources chapter for URLs), but the Scripts menu is nevertheless and excellent device for running scripts with no overhead. In the next chapter I discuss some third-party tools that can provide palettes with buttons for running scripts, and even toolbars you can make yourself if you are up to it.



 


Click here to find out more about our best subscription bundle deal ever!
2 years of the magazine, and the all new MacTech DVD ... at 70% off!



Click on the cover to
see this month's issue!

TRIAL SUBSCRIPTION
Get a RISK-FREE subscription to the only technical Mac magazine!
 
 


MacTech Magazine. www.mactech.com
Toll Free 877-MACTECH, Outside US/Canada: 805-494-9797

Register Low Cost (ok dirt cheap!) Domain Names in the MacTech Domain Store. As low as $1.99!
Save on brand compatible and name brank ink jet and laser supplies.
Save on long distance * Upgrade your Computer
Movies with No Late Fees!

See local info about Westlake Village
SJ * BRJ * BJ * OJ * NITS
Staff Site Links



All contents are Copyright 1984-2008 by Xplain Corporation. All rights reserved.

MacTech is a registered trademark of Xplain Corporation. Xplain, Video Depot, Movie Depot, Palm OS Depot, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, NetProLive, JavaTech, WebTech, BeTech, LinuxTech, Apple Expo, MacTech Central 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.