Wednesday, July 23, 2014

#1 2009-06-04 12:44:49 pm

macbrock
Member
Registered: 2007-04-06
Posts: 63

Insert picture ppt 2008

Ok, this script and another i was working on worked last night. I keep getting class errors. This one keeps telling me that "can't make class picture" the syntax looks correct, any thoughts?

Applescript:

tell application "Microsoft PowerPoint"
   activate
   set filePath to "Macintosh HD:Users:Brock:Desktop:test:j0150023.jpg"
   set thePres to active presentation
   make new picture at the end of slide 1 of thePres with properties ¬
       {file name:filePath, top:50, left position:100, height:300, width:300} ¬
           
end tell

I've done other scripting before, but PPT seems to be alot harder, as in code that i cut and paste doesn't work majority of time.


Filed under: microsoft, Powerpoint

Offline

 

#2 2009-06-04 03:42:00 pm

macbrock
Member
Registered: 2007-04-06
Posts: 63

Re: Insert picture ppt 2008

Ok, script is working, but if anyone else can replicate, it seems to crop the first slide. But this is essentially designed to allow us ppt users to make photo albums that seems to have been left out of ppt 2008.

Applescript:

(* Source code courtesy of Jason A. at Officeformac.com
This script was modified by Brock B to replicate ppt photo album feature.
*)



tell application "Finder" to set picFolder to every file in folder (choose folder)
log (count picFolder)

tell application "Microsoft PowerPoint"
   activate
   set newPres to make new presentation
   set theSlide to make new slide at end of newPres with properties {layout:slide layout object}
   repeat with xName in picFolder
       make new picture at end of last slide of active presentation with properties {file name:(xName as text), top:1, left position:1, height:540, width:720, lock aspect ratio:true} --makes pictures full sized
       make new slide at end of active presentation
   end repeat
end tell


Filed under: microsoft, Finder, Powerpoint

Offline

 

#3 2012-07-02 12:16:09 pm

macmadness86
Member
Registered: 2012-01-28
Posts: 12

Re: Insert picture ppt 2008

I have been looking everywhere for a solution to my problem and this is it! Thank you sooooo much. I was indeed able to replicate the problem with the first slide though. It is too bad. I am not sure what is causing that. I suppose it may be possible to create a blank slide as a dummy and add the pictures thereafter. I haven't tried it yet because I am so exicted.

My usage: Create backgrounds using Xelatex (for the nice slide guide, which is hard to replicate in PP), separate the output into individual PDF files and import them in PowerPoint. The Automator image slide show maker on mac does not support PDF, but your script does!

If I make any improvements, I will be sure to post them here.
big_smile

Ok I found the problem and the fixed AppleScript can be found below. The problem is that the first slide of the presentation is a title slide by default. You have to use the blank layout slide, in order for this to work. Just add the property {layout: slide layout blank} and you are good to go.

Applescript:


tell application "Finder" to set picFolder to every file in folder (choose folder)
log (count picFolder)

tell application "Microsoft PowerPoint"
   activate
   set newPres to make new presentation
   --set properties of slide 1 of active presentation to {layout:slide layout blank}
   set theSlide to make new slide at end of newPres with properties {layout:slide layout blank}
   repeat with xName in picFolder
       make new picture at end of last slide of active presentation with properties {file name:(xName as text), top:0, left position:0, height:541, width:722, lock aspect ratio:true} --makes pictures full sized
       make new slide at end of active presentation with properties {layout:slide layout blank}
   end repeat
end tell

For more details on using this script to produce powerpoint slides with the beamer class in xelatex, see http://tex.stackexchange.com/questions/ … 1831#61831

Last edited by macmadness86 (2012-07-10 06:24:50 am)

Offline

 

#4 2014-06-03 08:17:25 am

macmadness86
Member
Registered: 2012-01-28
Posts: 12

Re: Insert picture ppt 2008

I made some improvements!

Check out this Automator Action I made for inserting pictures into slides:

http://ul.to/7x7w26r6

Based on discussion here: http://macscripter.net/viewtopic.php?pid=173022#p173022

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.028 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)