Open application when file double clicked
pete at lcsql.com
Tue Feb 24 15:22:06 EST 2015
Thank you Richard and Jacque. Here's the current status.
At Jacque's suggestion I moved the appleevent handler to my main stack
script and removed the code that inserted it as a front script. The result
of that was the same as with the appleevent handler in a front script,
meaning if the app is already open and I double click a file associated
with it, the odoc apple event is triggered and all works as expected, but
if the app is not already running, no odoc event. Richard - not sure how
that affects your bug report. Not sure why, but I prefer having the
handler in the main stack script than in a front script.
Next, I put an answer statement in the applevent handler if it sees an oapp
event but I did not get one no matter whether the app was running or not.
One little oddity - it appears that the default stack is not the
application's main stack when I receive the apple event (whether in a front
script or the main stack script). The applevent handler calls a handler in
my main stack script which in turn refers to a control in the main stack.
I got a run time error that the control doesn't exist. I then changed the
defaultstack to my main stack in the applevent handler and all worked fine
On Tue Feb 24 2015 at 11:53:52 AM Richard Gaskin <ambassador at fourthworld.com>
> Peter Haworth wrote:
> > I added a button to my application and put the appleevent handler in its
> > script. Added a startup handler to the first card of my main stack to
> > insert the button script into front. Built the standalone.
> > Double clicked a file associated with the application while the
> > was not running. The application launched but no appleevent. Double
> > clicked again with the application running and got an "odoc" apple event.
> > So progress made but still no joy as far as double clicking when the
> > application is not running.
> Thanks for confirming that appleEvent handlers that need aevt/odoc must
> be in a frontScript to trigger.
> This annoyance is apparently caused by one of the Rev scripts that get
> added to your standalone at build time, which traps that message for
> those params and doesn't pass the message - bug report filed:
> I believe if you add oapp to the events you're handling you should be
> fine now.
> Please let us know how it works out.
> Now a question for everyone else:
> How do you handle your documents on Mac without aevt/odoc? Why is this
> bug one that's only being filed now? Do all of you who make
> document-centric apps put your ae handlers in frontScripts? No one else
> has seen this but Peter and me?
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> Ambassador at FourthWorld.com http://www.FourthWorld.com
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
More information about the Use-livecode