PowerPoint's save as PDF in AppleScript results in print job
It took me a few hours to come up with a solution that works in my environment.
Please note that some elements need internationalization like &quot;Vorschau&quot; or &quot;Sichern&quot;. This is a german solution working with PowerPoint for Mac 16.16.27 on macOS HighSierra 10.13.6.
I had to heavily debug things with Script Debugger ($99 well spent ..) to get things working. Please note how Preview is used for the actual PDF saving. I tried doing this from Powerpoint but it was unreliable.
-- 2018-01-31
-- https://github.com/irmowan/Convert-ppt-to-pdf/blob/master/Convert-ppt-to-pdf.applescript
-- modified by WF 2020-11-15
-- 
-- ppt2Pdf({&quot;/Users/wf/Projekte/2020/Infrastruktur2020/ppt2pdf&quot;, &quot;TestMe.pptx&quot;})

--http://hints.macworld.com/article.php?story=20050523140439734
-- passing command line arguments to applescript
on run (argv)
    log (count (argv))
    if ((count of argv) &lt; 2) then
        log &quot;usage: ppt2pdf basepath [filenames]&quot;
    else
        my ppt2Pdf(argv)
    end if
end run

--
-- convert powerpoint to pdf on the given list of files
--
on ppt2Pdf(fileNames)
    log &quot;launching Powerpoint ...&quot;
    set pp to &quot;Microsoft PowerPoint&quot;
    tell application pp -- work on version 15.15 or newer
        launch
        set isfirst to true
        repeat with fileName in fileNames
            if isfirst then
                set basepath to fileName
                log &quot;base path is &quot; &amp; basepath
                set isfirst to false
            else
                if fileName ends with &quot;.ppt&quot; or fileName ends with &quot;.pptx&quot; or fileName ends with &quot;.pptm&quot; then
                    set filePath to basepath &amp; &quot;/&quot; &amp; fileName
                    -- set filePath to POSIX path of fileAlias
                    set pdfPath to my makeNewPath(filePath)
                    log &quot;trying to convert powerpoint file &quot; &amp; filePath &amp; &quot; to &quot; &amp; pdfPath
                    open filePath
                    
                    -- save active presentation in pdfPath as save as PDF 
                    -- save in same folder
                    -- https://macscripter.net/viewtopic.php?id=26342
                    --tell application &quot;System Events&quot;
                    --  set listOfProcesses to (name of every process where background only is false)
                    --  tell me to set selectedProcesses to choose from list listOfProcesses with multiple selections allowed
                    --end tell
                    --repeat with processName in selectedProcesses
                    --  log processName
                    --end repeat
                    
                    if not my chooseMenuItem(pp, &quot;Datei&quot;, &quot;Drucken...&quot;) then
                        error number -128
                    end if
                    
                    --my showUiElements(pp, &quot;menu button&quot;)
                    -- my waitFor(button whose description is &quot;PDF&quot;, 5, 0.5)
                    my choosePopUp(pp, &quot;Layout für den Druck&quot;, &quot;Notizen&quot;)
                    my choosePopUp(pp, &quot;Farbausgabeformat&quot;, &quot;Farbe&quot;)
                    --my chooseMenuButtonItem(pp, &quot;PDF&quot;, &quot;Als PDF sichern&quot;)
                    local myTitle
                    tell application &quot;System Events&quot;
                        -- the magic of Applescript
                        -- if you really want the title and not a reference to it you need to use an operator
                        -- http://books.gigatux.nl/mirror/applescriptdefinitiveguide/applescpttdg2-CHP-12-SECT-5.html
                        set myTitle to title of window 1 of process pp &amp; &quot;&quot;
                    end tell
                    my chooseMenuButtonItem(pp, &quot;PDF&quot;, &quot;In Vorschau öffnen&quot;)
                    delay 5
                    tell application &quot;System Events&quot;
                        log &quot;waiting for Vorschau to display &quot; &amp; myTitle
                        set timeLeft to my waitForAppearWindow(myTitle, process &quot;Vorschau&quot;, 30, 0.5)
                        if timeLeft &lt; 0 then
                            log &quot;Vorschau &quot; &amp; myTitle &amp; &quot; window didn't show up after 30 secs&quot;
                            error number -128
                        else
                            log &quot;Vorschau appeared with &quot; &amp; timeLeft &amp; &quot;secs left&quot;
                            tell process &quot;Vorschau&quot;
                                delay 0.2
                                click menu item &quot;Als PDF exportieren …&quot; of menu 1 of menu bar item &quot;Ablage&quot; of menu bar 1
                                delay 0.5
                                -- CMD-SHIFT-G to set the export director
                                -- https://dougscripts.com/itunes/itinfo/keycodes.php
                                keystroke &quot;g&quot; using {command down, shift down}
                                delay 0.2
                                
                                tell sheet 1 of window (myTitle)
                                    tell sheet 1
                                        -- dereference basePath
                                        local basePathStr
                                        set basePathStr to basepath &amp; &quot;&quot;
                                        set value of first combo box to basePathStr
                                        delay 0.2
                                        click button &quot;Öffnen&quot;
                                        delay 0.2
                                    end tell
                                    click button &quot;Sichern&quot;
                                    set timeLeft to my waitForAppear(sheet 1, 3, 0.2)
                                    tell sheet 1
                                        if timeLeft &gt; 0 then
                                            click button &quot;Ersetzen&quot;
                                        end if
                                    end tell
                                    delay 5
                                    keystroke &quot;q&quot; using {command down}
                                end tell
                                
                            end tell
                        end if
                    end tell
                    
                    --tell application &quot;System Events&quot;
                    --  set timeLeft to my waitForAppear(&quot;button&quot;, button &quot;Sichern&quot; of sheet 1 of sheet 1 of window 1 of process pp, 5, 0.5)
                    --  if timeLeft &lt; 0 then
                    --      log &quot;Sichern button didn't show up after 5 secs&quot;
                    --      error number -128
                    --  end if
                    --  click button &quot;Sichern&quot; of sheet 1 of sheet 1 of window 1 of process pp
                    --end tell
                    
                    --tell application &quot;System Events&quot;
                    --  delay 0.5
                    --  try
                    --      set timeLeft to my waitForAppear(&quot;button&quot;, button &quot;Ersetzen&quot; of sheet 1 of sheet 1 of sheet 1 of window 1 of process pp, 5, 0.5)
                    --      if timeLeft &lt; 0 then
                    --          log &quot;Ersetzen button didn't show up after 5 secs&quot;
                    --          error number -128
                    --      end if
                    --      click button &quot;Ersetzen&quot; of sheet 1 of sheet 1 of sheet 1 of window 1 of process pp
                    --  end try
                    --end tell
                    log &quot;done ...&quot;
                    -- close filePath
                end if
            end if
        end repeat
        -- still in tell powerpoint context
        --tell application &quot;System Events&quot;
        --  delay 0.5
        --  try
        --      set timeLeft to my waitForVanish(&quot;window&quot;, window &quot;Sichern&quot; of process pp, 60, 1)
        --      if timeLeft &lt; 0 then
        --          log &quot;print dialog didn't vanish after 60 secs&quot;
        --          error number -128
        --      end if
        --  end try
        --end tell
        quit
    end tell
end ppt2Pdf

on showElement(uiElem)
    local className
    set className to class of uiElem as string
    log (((«class pDSC» of uiElem as string) &amp; &quot;=&quot; &amp; value of uiElem as string) &amp; &quot;(&quot; &amp; className) &amp; &quot;)&quot;
end showElement

--
-- show all UI elements
--
on showUiElements(appName, filterClassName)
    tell application &quot;System Events&quot;
        tell process appName
            tell (1st window whose value of attribute &quot;AXMain&quot; is true)
                repeat with uiElem in entire contents of it as list
                    try
                        local className
                        set className to class of uiElem as string
                        if filterClassName is missing value or className is filterClasssname then
                            log (((description of uiElem as string) &amp; &quot;=&quot; &amp; value of uiElem as string) &amp; &quot;(&quot; &amp; className) &amp; &quot;)&quot;
                        end if
                    end try
                end repeat
            end tell
        end tell
    end tell
end showUiElements

--
-- wait for the given element to appear
--
on waitForAppearWindow(elementName, parentElement, time, slice)
    set timeLeft to time
    set appeared to false
    repeat until (appeared) or timeLeft ≤ 0
        try
            set appeared to window elementName of parentElement exists
        end try
        delay slice
        log &quot;.&quot;
        set timeLeft to timeLeft - slice
    end repeat
    log timeLeft
    return timeLeft
end waitForAppearWindow

--
-- wait for the given element to appear
--
on waitForAppear(element, time, slice)
    set timeLeft to time
    set appeared to false
    repeat until (appeared) or timeLeft ≤ 0
        try
            set appeared to element exists
        end try
        delay slice
        log &quot;.&quot;
        set timeLeft to timeLeft - slice
    end repeat
    log timeLeft
    return timeLeft
end waitForAppear

---
--- wait for the given element to vanish
---
on waitForVanish(element, time, slice)
    set timeLeft to time
    try
        repeat while (exists element) and timeLeft &gt; 0
            delay slice
            log &quot;.&quot;
            set timeLeft to timeLeft - slice
        end repeat
    end try
    log timeLeft
    return timeLeft
end waitForVanish


on chooseMenuButtonItem(appName, buttonName, itemName)
    tell application &quot;System Events&quot;
        tell process appName
            tell window 1
                local win1
                set win1 to it
                tell sheet 1
                    log &quot;choosing &quot; &amp; itemName &amp; &quot; of menu button &quot; &amp; buttonName
                    tell menu button buttonName
                        click
                        delay 0.1
                        tell menu 1
                            click menu item itemName
                        end tell
                    end tell
                end tell
            end tell
        end tell
    end tell
end chooseMenuButtonItem
--
-- choose a popup 
--
on choosePopUp(appName, buttonName, itemName)
    tell application &quot;System Events&quot;
        tell process appName
            tell window 1
                tell sheet 1
                    log &quot;choosing &quot; &amp; itemName &amp; &quot; of pop up menu &quot; &amp; buttonName
                    --repeat with pbutton in pop up buttons
                    --  local pbutton1
                    --  set pbutton1 to pbutton
                    --  log description of pbutton &amp; &quot;=&quot; &amp; value of pbutton
                    --end repeat
                    tell (1st pop up button whose description is buttonName)
                        click it
                        delay 0.5
                        pick menu item itemName of menu 1
                    end tell
                end tell
            end tell
        end tell
    end tell
end choosePopUp

--
-- https://developer.apple.com/library/archive/documentation/
-- LanguagesUtilities/Conceptual/MacAutomationScriptingGuide
-- AutomatetheUserInterface.html#//apple_ref/doc/uid/TP40016239-CH69-SW17
--
on chooseMenuItem(theAppName, theMenuName, theMenuItemName)
    try
        -- Bring the target app to the front
        tell application theAppName
            activate
        end tell
        
        -- Target the app
        tell application &quot;System Events&quot;
            tell process theAppName
                
                -- Target the menu bar
                tell menu bar 1
                    
                    -- Target the menu by name
                    tell menu bar item theMenuName
                        tell menu theMenuName
                            
                            -- Click the menu item
                            log &quot;clicking &quot; &amp; theMenuItemName
                            click menu item theMenuItemName
                        end tell
                    end tell
                end tell
            end tell
        end tell
        return true
    on error
        return false
    end try
end chooseMenuItem



on makeNewPath(f)
    set t to f as string
    if t ends with &quot;.pptx&quot; or t ends with &quot;.pptm&quot; then
        return (text 1 thru -5 of t) &amp; &quot;pdf&quot;
    else
        return (text 1 thru -4 of t) &amp; &quot;pdf&quot;
    end if
end makeNewPath