insert picture in ppt 2008

E

elpada

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

Ok, i'm having trouble with inserting pictures in ppt 2008 using applescript. I have cut and pasted the code

tell application "Microsoft PowerPoint"

set thePres to active presentation
make new picture at the beginning of slide 1 of thePres with properties ¬
{file name:"Macintosh HD:Shared:pictures:picture.jpg", ¬
top:100, left position:100, height:300, width:300}-- from the mactopia website.

I've changed the path of the picture to a jpg on my computer, but inserting the picture seems to be hit and miss. i regularly get "can't make class picture"
I've never had this much trouble with AS before. Currently i have no problem inserting slides and text but the pictures are impossible. Thoughts?
 
E

elpada

Ok, i think i got this covered. still having class errors randomly though everytime i mess with the code slightly.
 
E

elpada

Ok, i got it with a little borrowing, but it seems to "crop" my first image but inserts all of the rest correctly.

(* Source code courtesy of Jason Andersen at Officeformac.com
* )

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

This script will ask you for a folder of pictures, open ppt, make a new presentation and then insert the pictures. I don't know why but it seems to crop the first picture in the presentation (can be fixed manually, but annoying). Don't know why its cropping it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top