• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launching one Applescript app with another Applescript app fails in OS X 10.8


  • Subject: Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
  • From: Jim Skibbie <email@hidden>
  • Date: Thu, 04 Apr 2013 16:29:55 +0000
  • Thread-topic: Launching one Applescript app with another Applescript app fails in OS X 10.8

I think the issue you are having is some type of race condition where your "on run" handler is still running from the launch command and then the second handler gets a 'connection is invalid' because the app is busy doing something else. This is definitely broken from how launch used to work, and I have reported it as a bug. I guess the more bug reports the better is all I can suggest.

Here is what I'm suggesting as a workaround to your scenario:

calling.app:
property hostAppl : "called"


on run

try

launch application hostAppl

tell application hostAppl to theHandlerFormerlyKnownAsRun() -- instead of on run, move the contents to its own handler

tell application hostAppl to doSomethingElse() -- comment out and see what happens

tell application hostAppl to quit

on error errText number errNr

activate me

"CallingApp Error = " & errNr & return & errText

tell me to display dialog the result buttons {"OK"} default button 1

end try

end run


called.app (saved as 'Stay Open'):
on open

end open


on theHandlerFormerlyKnownAsRun()

activate me

tell me to display dialog "Running" buttons {"OK"} default button 1

end theHandlerFormerlyKnownAsRun


on doSomethingElse()

activate me

tell me to display dialog "What do you want to do?" buttons {"OK"} default button 1

end doSomethingElse




I just started up in 10.8.3 to test this. Adding an 'on open' handler to the called application made no difference at all. I get exactly the same behavior as before, including the -609 error which prevented calling the handler in the called script.

Just to make sure we are discussing the same problem, here are my scripts.

My CALLING script is ...

property hostAppl : "OSX_Mt_Lion: ???."
on run
try
launch application hostAppl
tell application hostAppl to doSomethingElse() -- comment out and see what happens
on error errText number errNr
activate me
"CallingApp Error = " & errNr & return & errText
tell me to display dialog the result buttons {"OK"} default button 1
end try
end run -----------------------------

and my CALLED script (property hostAppl , above) is ...

on run
activate me
tell me to display dialog "Running" buttons {"OK"} default button 1
end run

on open


end open

on doSomethingElse()
activate me
tell me to display dialog "What do you want to do?" buttons {"OK"} default button 1
end doSomethingElse

When the CALLING application calls the CALLED application, I get the "Running" dialog followed by the "CallingAppError" dialog, then nothing.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
      • From: Luther Fuller <email@hidden>
    • Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
      • From: Jim Skibbie <email@hidden>
    • Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
      • From: Luther Fuller <email@hidden>
References: 
 >Re: Launching one Applescript app with another Applescript app fails in OS X 10.8 (From: Jim Skibbie <email@hidden>)

  • Prev by Date: Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
  • Next by Date: Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
  • Previous by thread: Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
  • Next by thread: Re: Launching one Applescript app with another Applescript app fails in OS X 10.8
  • Index(es):
    • Date
    • Thread