Reputation: 2834
I need to automate my app by passing a series of parameters to it at once. In Windows I pass them all as a command line from a shortcut but I need to do the same for OSX.
I have been looking at AppleScript but it seems I would need to send each parameter separately like tell myapp to use <x>
then tell myapp to use <y>
. Automator looks like it could do what I want but looks way too complicated.
My ultimate goal is to send a series of text parameters followed by a list of file paths by dropping files onto an icon on the desktop.
What would be the best way to achieve this?
Upvotes: 1
Views: 164
Reputation: 1127
If I understood correctly, the app in question accepts command line arguments. Then, all you need is an AppleScript droplet which receives files and passes their paths as (whitespace-separated) arguments to the shell command:
on open these_items
set file_args to ""
repeat with one_item in these_items
set file_args to file_args & " " & quoted form of POSIX path of one_item
end repeat
set command to "open" -- replace this with your shell command + arguments
do shell script (command & file_args)
end open
(based on this forum post)
Upvotes: 1