• 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: How to quit an applet?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to quit an applet?


  • Subject: RE: How to quit an applet?
  • From: "Francois Houle" <email@hidden>
  • Date: Thu, 9 Jun 2005 15:04:54 -0400
  • Thread-topic: How to quit an applet?

I wanted to do the same as Neil did and even after trying both solutions I could not have the script end until Safari quit... It basically waits until the process which it started would end.
On run did not change anything... Having both "ignoring application responses" and "on run" will not allow to compile, and having only "ignoring..." keeps the script open as well.
If I add "quit script" to it, then it states that the script cannot quit until the process has finished.
Any one have other ideas or suggestions on how to resolve this ?
 
Frank


From: applescript-users-bounces+francois.houle=email@hidden [mailto:applescript-users-bounces+francois.houle=email@hidden] On Behalf Of Peter Clarke
Sent: Thursday, June 09, 2005 11:53 AM
To: Brian Johnson
Cc: email@hidden
Subject: Re: How to quit an applet?


On 8 Jun 2005, at 02:50, Brian Johnson wrote:


On Tue, 7 Jun 2005, Neil Lee wrote:


I created a very basic applescript application that only has to run a shell command and then quit. Here's the code:

on run
   do shell script "/Volumes/lester/Development/Webkit/WebKitTools/ Scripts/run-safari &"
   quit
end run

The problem is that after Safari launches, the script applet doesn't quit. It hangs and I have to force quit it.


I think this is it... Look at this line from one of my scripts

   set x to "/scripts/stopmysql > /dev/null 2>&1&"

The stuff at the end insures that the "do shell script" that comes next returns immediately, so my script can quit (or, in this case, poll the mysql process to see if it's quit yet).

This is explained in "TN2065-do shell script.pdf" on the apple dev web site (sorry, I downloaded my copy ages ago).


---------------------------------------------------------------------------------------------------------------------------------------------------------
I think that the problem is that the Script is set to run in the background (the & at the end it it tells it to do this)
- So I am presuming that the script takes some time to run - ie more then just a few seconds.

So Your Apple Script has to wait for it to finish running, before it too can finish.

However it is not necessary for the AppleScript to wait - since the script is running in the background not the foreground.

So in AppleScript you could say:

    "ignoring application responses"    - and then AppleScript is allowed "to finish"
    - even though the script it is running (in the background) has not itself yet finished.

EG:
-----------------------------------------------------------
ignoring application responses
    on run
       do shell script "/Volumes/lester/Development/Webkit/WebKitTools/ Scripts/run-safari &"
    end run
end ignoring
-----------------------------------------------------------

    -- Peter


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: How to quit an applet?
      • From: Neil Lee <email@hidden>
  • Prev by Date: do shell script error from within Filemaker
  • Next by Date: Re: do shell script error from within Filemaker
  • Previous by thread: Re: How to quit an applet?
  • Next by thread: Re: How to quit an applet?
  • Index(es):
    • Date
    • Thread