Open application when file double clicked

Peter Haworth pete at lcsql.com
Mon Feb 23 14:50:51 EST 2015


I found the following handler on the forum for launching an OSX application
when an associated file is double clicked

on appleEvent pClass,pID

   local tFiles

   if pClass is "aevt" and pID is "odoc" then
      request appleEvent data
      put it into tFiles ## files OS is requesting your application opens,
one per line
      if tFiles is not "not found" and tFiles is not empty then
         openDB line 1 of tFiles
      end if
   else
      pass appleEvent
    end if

end appleEvent

I put that into the script of the first card of my application's main
stack. openDB is a handler in my main stack script.

Built the standalone and associated a file with my application then double
clicked it.  My application opened but did not open the file.  I added some
answer commands to the appleEvent handler including one right at the
beginning, re-built the application and tried again but nothing was
displayed.

It appears the apple event is never reaching my application.  Maybe the
code I found is out of date somehow?  This is on Yosemite.



More information about the use-livecode mailing list