I would like to set the default file association for a file type (PDF) to an Apple Script app. The Apple Script app will open the file type on a remote machine (using remote Apple events) with a specific app (Preview.app). Not that it matters but, the remote machine is a virtual machine on the local machine. I think the script should look something like this:
set remoteMachine to "eppc://elcapitan.local" tell application "finder" of machine remoteMachine open ("/Applications/Preview.app" as POSIX file as alias) end tell set pathToLocalOnRemote to "/Volumes/cajal" repeat with fn in argv tell application "Preview" of machine remoteMachine open pathToLocalOnRemote & fn end tell end repeat
What is not clear to me is, what actually happens when a file type (PDF) is opened in the Finder? The default file association will specify which app to use. Inside the app, is there just a binary that is called which gets a list of file names as its argument? If so, is this binary just like some command line binary? In sum, can I trust Finder will execute my script by something analogous to a command line call with a list of files as the argument? Also, will the file name list be given as the (full) absolute path?