Fixed my problem, but only at the expense of setting up a script that places files from a folder into a PP slide. It creates a new rectangular shape the same size as the images (in pixels at 72 dpi), and then uses the user picture command to fill the shape with the picture. Note that the PP 2004 Applescript Guide has it WRONG: the syntax of the user picture command is:
user picture of PicShape picture file PathToPic
NOT:
user picture fill of PicShape picture file PathToPic
I screwed around with this FOREVER before thinking, “Hey, maybe the fill needs to go,” since the syntax of the command is user picture shape/fill format. Nothing like going to the reference document and finding THE WRONG INFORMATION in it. If Apple’s Keynote program was even vaguely scriptable (and I must say my feelings about Apple’s iWork went down severely upon finding that it isn’t particularly scriptable), I’d dump Microsoft products in an instant. Finding the wrong information in the PP Applescript Guide after having the whole paste object fiasco (see above) was like a last kick in the teeth.
But here is a functional script. It is designed to do a specific task for me, namely to take folders dropped on the application script, search through them for files with “jpg” as a file extension inside a folder called “Montages”, and then pipes the pics that fit those criteria to the “DoSlide()” subroutine where they are added into new slides (which have my custom layout consisting of a blank slide with a single title place holder). This routine pastes the folder hierarchy (dumped folder – first subfolder – second subfolder – etc.) in the title, creates a rectangular shape the size of my images, and then uses user picture to fill the shape with the picture.
If you use it, you’ll want to generalize it a bit so that you don’t need to put your pics into a folder called “Montages”. Unfortunately, using the user picture command REQUIRES a shape of the exact size of the image to be pasted, or you get scaling of your pic to fit the shape. If all your images are all the same size, you can set the values of the auto shape properties to fit them. NOTE: the values of the width and height properties of auto shape are pixels at 72 dpi. Therefore, if you paste in an image that is 7 x 8.273 inches at 150 dpi (equal to 1050 x 1241 pixels), you want to set your values to those I use, namely 504 width and 596 height, which are derived from 7 x 72 = 504 and 7 x 8.273 = 596 pixels. As far as I can tell, PP ignores the resolution of your picture and only cares about the dimensions, and changes your image to be 72 dpi at those dimensions. If it’s not right, it will stretch or shrink your image to fit the dimensions of the auto shape.
Hope this helps.
Cheers,
Richard
on open FolderList
set ListOfFolders to every item of FolderList
repeat with i from 1 to (the number of items in ListOfFolders)
set CurrentFolder to item i of ListOfFolders as alias
set CurrFolInfo to info for CurrentFolder
if folder of CurrFolInfo is true then
set FolderName to the name of CurrFolInfo
ProcessFolder(CurrentFolder, FolderName)
end if
end repeat
end open
on ProcessFolder(TheFolder, TheFolderName)
set TheFolderItems to list folder TheFolder without invisibles
repeat with i from 1 to the count of TheFolderItems
set TheItem to alias ((TheFolder as text) & (item i of TheFolderItems) & ":")
set TheItemInfo to info for TheItem
if folder of TheItemInfo is true then
if the name of TheItemInfo is "Montages" then
DoPowerPoint(TheItem, TheFolderName)
else
set NewFolderName to (TheFolderName & " -- " & (the name of TheItemInfo)) as text
ProcessFolder(TheItem, NewFolderName)
end if
end if
end repeat
end ProcessFolder
on DoPowerPoint(MontageFolder, ThisFolderName)
set MontageFolderItems to list folder MontageFolder without invisibles
repeat with i from 1 to the count of MontageFolderItems
set ThisItemName to ""
set ThisItem to alias ((MontageFolder as text) & (item i of MontageFolderItems))
set ThisItemInfo to info for ThisItem
if the name extension of ThisItemInfo is "jpg" then
set ThisItemName to the name of ThisItemInfo
set NumChars to the number of characters in ThisItemName
set ThisItemName to text 1 thru (NumChars - 4) of ThisItemName
set TitleText to ThisFolderName as text
DoSlide(ThisItem, TitleText)
end if
end repeat
end DoPowerPoint
on DoSlide(SlideItem, TheTitle)
set TheTemplate to "RESRansom:New Microscopy:MicroImages.pptx" as alias
set PathToPic to SlideItem as text
tell application "Microsoft PowerPoint"
launch
activate
open TheTemplate
set TheNewSlide to make new slide at the end of active presentation with properties {layout:slide layout custom}
set content of text range of text frame of place holder 1 of TheNewSlide to TheTitle
set PicShape to make new shape at the end of TheNewSlide with properties {auto shape type:autoshape rectangle, left position:18, top:100, width:504, height:596}
user picture of PicShape picture file PathToPic
end tell
end DoSlide