How to create an application with applescript that will be able to open a file from finder
Using the argv
parameter with the run
handler is designed for arguments passed to the script when using it with osascript
from the command line. In a regular AppleScript application, an open
handler is passed a list of aliases (HFS paths), for example:
on open fileItems
repeat with anItem in fileItems
# do something with anItem
end repeat
end open
From your snippet, you would do something like:
on open fileItems
do shell script "/usr/local/bin/zathura " & quoted form of POSIX path of item 1 of fileItems
end open
Note that you should use the POSIX path of items when using them with the shell, and the paths should also be quoted or have characters special to the shell escaped.
See the AppleScript Language Guide for more information.