I want to write an Apple Script that converts me Microsoft PowerPoint presentations into PDFs. I started with a small version, but strange enough, already that very short stub fails:
on run arguments tell application "Finder" set fileAlias to POSIX file (first item of arguments) as alias tell application "Microsoft PowerPoint" open fileAlias end tell end tell end run
The argument provided refers to a valid .pptx file. But when calling the script via
osascript path/to/script.scpt ~/path/to/file.pptx
PowerPoint 2016 opens, but shows an empty presentation instead of the presentation in file.pptx.
When I slightly change the script, it actually opens the file:
on run arguments tell application "Finder" set fileAlias to POSIX file (first item of arguments) as alias open fileAlias end tell end run
Why is the file opened when the open command is not issued within the PowerPoint application block, and is not opened when issued within the block? Is it possibly a timing issue?