Re: Scripting PowerPoint
Re: Scripting PowerPoint
- Subject: Re: Scripting PowerPoint
- From: Paul Berkowitz <email@hidden>
- Date: Sat, 04 Feb 2006 23:38:29 -0800
- Thread-topic: Scripting PowerPoint
On 2/4/06 7:45 PM, "Rick Davis" <email@hidden> wrote:
> I've seen this asked on another list with no responses, so I thought
> I would ask the experts. I've been able to script a folder action to
> save a regular PowerPoint document dropped into the folder into a
> PowerPoint Show, QuickTime Movie, RTF or HTML file (actually found a
> pre-built script from Apple that led the way). But I can't figure
> out how to get it to save documents as one of the "Specialty
> Formats", JPEG, PNG, etc.
It's missing. PPT 2004 uses the same object model as its VBA. If you check
in the VBA Help (Tools/Macros/VB Editor/Help/VBA Help), you'll see that the
method SaveAs has the same few enumerations for FileFormat argument as the
'as' parameter of the Applescript 'save' command in Standard Suite -
HTML,template, presentation, movie, RTF, etc. So a few of those are
possible. (Unfortunately, the PPT Applescript Reference omits the Standard
Suite, thus the 'save' command.)
The full list, as you'll see if you check the 'as' enumerations for 'save'
in the dictionary, is:
save as addIn
save as default
save as HTML
save as presentation
save as RTF
save as show
save as template
That omits the graphic formats you see in "Speciality Formats' in the Save
As menu item in the UI. There's also a (weird) 'save as movie settings'
property of presentation that lets you set oodles of options that take
effect when saved as a movie. You might need those if you do.
In the VBA Help, you'll find options for the graphics formats in the Export
method, specifically its FilterName argument. But there seem to be some
issues that might make that argument moot on the Mac:
"FilterName Required String. The graphics format in which you want to
export slides. The specified graphics format must have an export filter
registered in the system registry. You can specify either the registered
extension or the registered filter name. PowerPoint will first search for a
matching extension in the registry. If no extension that matches the
specified string is found, PowerPoint will look for a filter name that
matches."
Well, there's no "registry" on the Mac. And there's no equivalent 'export'
command in AppleScript. I will inquire as to why not, but it looks like they
never got around to it, but maybe there's a more complex reason.
However, you can still do it using the old 'do Visual Basic' command,
converting VBA commands to strings. I first made a VBA macro - it works, but
it wants 3-character extensions, only. So "tif" works, but not "tiff" or
"TIFF". Here it is in AppleScript.
tell application "Microsoft PowerPoint"
do Visual Basic "ActivePresentation.Export Path:=\"PB G5 HD
Tiger:Users:berkowit:Pictures:Molly:\", FilterName:=\"tif\""
end tell
The Path argument needs a path to the subfolder where the presentation's
slides will be saved as "tif" (or "png" or "gif" etc.). You can't control
the individual file names - they will be Slide1.tif, Slide2.tif, etc. It
will make a subfolder of the name you specify in the Path argument if
there's not one there already. (Something it won't do for SaveAs.)
I'll find out why there's no native AppleScript 'export' command, nor
anywhere that lists the FilterNames that are honored, but at least you can
do it this way.
--
Paul Berkowitz
_______________________________________________
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