|
MacTech Network: MacForge.net | Computer Memory | Register Domains | Printer Supplies | Cables | iPod Deals | Mac Deals | Mac Book Shelf |
|
|
|
|
|
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
April, 2007 set allDocProps to every document property of active presentation repeat with i from 1 to count allDocProps set theDocProp to item i of allDocProps set theLog to theLog & "Property Number: " & i & return set theLog to theLog & "Property Name: " & name of theDocProp & return set theLog to theLog & "Property Value: " & value of theDocProp & return end repeat set theLog to theLog & "END =========================" & return end tell theLog Note that document property refers just to the built-in ones, although there's no "built in" in the name of the AppleScript class. Since, in AppleScript, document property is an element of the application, every document property gets all of them. (There appear to be 30.) This class is found in the Microsoft Office Suite, in all the Office applications. Adding some Custom properties in the UI does not add them to every document property. It should add them to the separate list of custom document properties. However, trying every custom document property does not get them either. That's a bug. Once you know the name of the property you're looking for, you can work with it. To display the value of a particular DocumentProperty, Template for example, in VBA: With ActivePresentation MsgBox .BuiltInDocumentProperties("Template").Value End With The AppleScript equivalent is: tell application "Microsoft PowerPoint" set templateValue to get value of document property ¬ "Template" of active presentation if templateValue missing value then display dialog templateValue else display dialog "There is no Template: this presentation is " & ¬ "based on a Blank New Presentation" with icon 2 end if end tell The template property value seems to be missing value (i.e., doesn't exist) whenever your presentation is not based on a template you have created or imported into your My Templates folder (or a subfolder of Templates folder) by selecting it in the Project Gallery. This is true also in VBA, but there you get a blank MsgBox. In AppleScript, you get an error message, so it's nicer to trap the error and provide a better message dialog. "Template" is a read-only property; you can't change it. Other properties like "Author" are read/write. To change the value of a read/write property in VBA, you'd do: With ActivePresentation .BuiltInDocumentProperties("Author") = "Your Name Here" End With It should have your name by default already (all Office applications know to look in the Entourage Address Book for the "Me" contact and use your name there for the Author document property.) But if you want a fancier version, say for business purposes, here's the AppleScript you could run on every commercial presentation you make and send out: tell application "Microsoft PowerPoint" set value of document property "Author" of active presentation to ¬ "Joe Blow, King of the World" end tell In the UI, go now to File/Properties/Summary, and you'll see it there loud and clear. (Don't worry, you can change it back…) In Summary You need to constantly compare the VBA Objects, Properties, and Methods to the classes, properties, elements, and commands in the AppleScript dictionary to try to work out which are equivalent. You can only do that now, in Office 2004, since the VB Editor will not exist in Office 2008. Your job is much harder in PowerPoint than in Word and Excel, since the PowerPoint dictionary seems to be missing a good third or so of the classes and properties you may need. But if you think creatively, you will often find workarounds. Of course, there's always the next version to look forward to, where hopefully many of these gaps will be filled. < Previous Page Next Page>
|
2 years of the magazine, and the all new MacTech DVD ... at 70% off! |
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
All contents are Copyright 1984-2007 by Xplain Corporation. All
rights reserved.