I do this directly using Automator scripts. This does not have access to the application, but rather to the workflow. This is beneficial because you can edit the settings / contents of some individual workflow elements.
I believe my answer is better for the question:
How to start an Automator workflow using AppleScript?
I believe that keeping Automator action at first helps avoid problems. eg.
set theWorkflowName to "Merge PDF Files" set myWorkflow to make new workflow with properties {name:theWorkflowName, path:POSIX path of ((path to temporary items as string) & theWorkflowName & ".workflow" as string)} set myWorkflow to open POSIX path of ((path to temporary items as string) & theWorkflowName & ".workflow" as string)
Merge PDF Files
on open the_Droppings -- CONVERT INPUT LIST OF ALIASES TO POSIX PATHS repeat with itemStep from 1 to count of the_Droppings set item itemStep of the_Droppings to POSIX path of item itemStep of the_Droppings end repeat tell application "Automator" activate set myWorkflow to open POSIX file "/Users/USERNAME/Dropbox/Scripts/Automator/Workflows/merge PDF files.workflow" set actionsList to name of Automator action of myWorkflow set firstAction to item 1 of actionsList tell myWorkflow (* get index of Automator action firstAction get input types of Automator action firstAction get path of Automator action firstAction get path of Automator action firstAction get value of setting of Automator action firstAction *) set value of setting of Automator action firstAction to the_Droppings -- MUST BE LIST OF POSIX PATHS end tell end tell end open
source share