Applescript to convert pptx file to ppt in Powerpoint 2016
I am trying to run the script (pasted below) to convert a powerpoint pptx file to ppt file using Office 2016. But it throws a lot of security warnings and finally the ppt that saves is missing some of the pptx specific content. It was working fine in earlier version of Office. If I manually open the file in powerpoint and then try to save it in ppt format, then also it throws the warning, but finally the ppt gets saved and also has the pptx content.
How can I fix this issue ? Does anyone have another script to convert pptx file to ppt in Office 2016 ?
Thanks,
-Nitin
on runargv
--we require exactly 3 arguments
--pptAppPath, src pptx, dest ppt
set ret to "0"
if not length of argv = 3 then set ret to "kError_IncorrectNumberOfArgs"
if ret = "0" then
set pptPath to item 1 of argv
set src to item 2 of argv
set dest to item 3 of argv
try
tell applicationpptPath
using terms from application "Microsoft PowerPoint"
launch
set pres to "1"
set presFound to false
set presCount to count of presentations
repeat with i from 1 to presCount
set curPres to presentationi
set curPresName to full name of curPres as string
if curPresName = src then
set pres to curPres
set presFound to true
endif
end repeat
if presFound then
try
--save active presentation in dest as «constant PPff
savepresindestas «constant PPff
on error errmesgnumbererrn
set ret to "kError_CouldNotSaveToDestinationPresentation"
end try
--close pres
else
set ret to "kError_CouldNotOpenSourcePresentation"
end if
end using terms from
end tell
on error
set ret to "kError_CouldNotOpenPowerpointApplication"
end try
end if
return ret
end run
iMac, OS X El Capitan (10.11.1)