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?

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.

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.

(* 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

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.
:smiley:

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.


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/21986/export-beamer-slides-to-powerpoint-openoffice-impress-keynote-editable-format/61831#61831

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