Hi all,
I tried to write a PPT merge Script for PowerPoint 2004 Mac.
All I need is some help copying all slides and saving the file.
I would be glad if anyone could find my mistake with the saving part and explain how to select and copy all slides of a presentation?
Thanks a lot.
Sabine
on run
tell application "Finder"
set this_folder to ((path to desktop folder as text) & "Eingang") as alias
set added_items to every item of folder this_folder
set pFolder to alias ((path to desktop folder as text))
try
set oFolder to folder "Originale" of pFolder
on error
tell pFolder to set oFolder to make folder with properties {name:"Originale"}
end try
try
set jFolder to folder "PPT" of pFolder
on error
tell pFolder to set jFolder to make folder with properties {name:"PPT"}
end try
tell application "Microsoft PowerPoint"
launch
activate
set visible to true
set newPres to make new presentation
set filename to {"test.ppt"}
make new slide at the beginning of the active presentation with properties {layout:slide layout title slide}
end tell
my processItems(added_items, oFolder, jFolder)
end tell
end run
on processItems(added_items, oFolder, jFolder)
set the item_count to the number of items in the added_items
tell application "Finder"
repeat with n from 1 to item_count
set aFile to item n of added_items as alias
set aName to POSIX path of aFile
set ext to text -4 thru -1 of aName
set ext2 to text -5 thru -1 of aName
if ext is in {".ppt", ".PPT"} then
tell application "Microsoft PowerPoint"
open aFile
end tell
my saveDoc1(jFolder, oFolder)
tell application "Finder" to move aFile to oFolder
else if ext is in {".pot", ".POT", ".pps", ".PPS"} or ext2 is in {".pptx", ".PPTX", ".potx", ".POTX", ".ppsx", ".PPSX"} then
tell application "Finder" to move aFile to oFolder
end if
end repeat
end tell
end processItems
on saveDoc1(jFolder, oFolder)
tell application "Finder"
-- set pFolder to alias ((path to desktop folder as text))
--set jFolder to folder "PPT" of pFolder as alias
set jFolder to ((path to desktop folder as text) & "PPT") as alias
end tell
tell application "Microsoft PowerPoint"
activate
set filename to {"test.ppt"}
set thisFile to active presentation
copy object slide 1 of active presentation
close thisFile
go to slide view of active window number 1
tell application "Microsoft PowerPoint"
do Visual Basic "ActivePresentation.Slides.Paste"
end tell
save active presentation in (jFolder & filename) as save as presentation
end tell
end saveDoc1