Open application when file double clicked

Peter Haworth pete at lcsql.com
Mon Feb 23 16:00:02 EST 2015


Thanks Paul.

The problem is, the file types involved are SQLite databases and there is
no standard file extension for them.  The most common is ".s3db" but I've
seen half a dozen other extensions used.

Does the apple event approach not work any more?  I thought if you
associated a file with an application in the Get Info dialog, that
application would be used to open the file.  I know that works because I've
used it to associate .doc files with Open Office and they open just fine
when I double click them.

I also found something on the list that mentioned looking at the global
variable $1 during preOpenCard and it would contain a file path if the app
was opened by double clicking a file.  I tried that too but still no joy.


On Mon Feb 23 2015 at 12:20:06 PM Paul Dupuis <paul at researchware.com> wrote:

> Your "Info.plist" file in the OSX app bundle needs to be edited to
> define the allowed file types that can be dropped on your application.
>
> This appears to be a OSX constraint that the OS only allows dropping of
> file types specified in the Info.plist file.
>
> In the standalone setting in the IDE you can define 1 document type for
> your standalone. The XML for that type in the plist file can then be
> copied to define additional types as you like.
>
>
> On 2/23/2015 2:50 PM, Peter Haworth wrote:
> > 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.
> > _______________________________________________
> > use-livecode mailing list
> > use-livecode at lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
> >
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list