• 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: kill switch for script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: kill switch for script


  • Subject: Re: kill switch for script
  • From: bryan <email@hidden>
  • Date: Wed, 17 Jul 2002 18:07:27 -0400

I take a bit of a different approach to the problem.

Since I have a verrry long loop in my script; it would be unwise
to sit and wait for several minutes with the keys pressed, while
the key status command came around.

So, what I did was I created a separate script that sets a quit
property; so that when the loop comes around, it finds the
property set, and quits.

here's the way the code is set up in the main script:

-------
--main_script
property quitflag : false
set my quitflag to false
--main loop
repeat
if my quitflag then exit repeat
do_stuff(here)
end repeat
-------
on quitit()
tell me to set quitflag to true
return quitflag
end quitit
-------
-------

and here's the external quit script:

-------
set taskmaster to "main_script"
repeat
tell application "Finder" to set myapplist to ((name of application processes) as
list)
if taskmaster is in myapplist then tell application taskmaster to quitit()
delay 30
end repeat
-------


Bryan Kaufman



> > Date: Wed, 17 Jul 2002 08:26:29 -0700
> > From: <email@hidden>
> > To: email@hidden
> > Subject: kill switch for script
> >
> > Hi all,
> >
> > I've got a question:
> >
> > I have a script that is running in a continual loop (repeat while). The script
> > is doing everthing it's supposed to do but I have no way of stopping it. Does
> > anyone know of an OSAX to kill a script or a way to script modifier keys so
> > that at the end of the loop I could make an IF statement that looked for
> > certain keys (i.e. - control+option+command+Q)being pressed and then would quit
> > the script?
> >
> > Any help here would be much appreciated!

[demime 0.98b removed an attachment of type text/x-vcard which had a name of bryan.vcf]
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: kill switch for script (From: "Marc K. Myers" <email@hidden>)

  • Prev by Date: Creator Types in OS X...
  • Next by Date: Making a repeat loop without slowing CPU
  • Previous by thread: Re: kill switch for script
  • Next by thread: Re: kill switch for script
  • Index(es):
    • Date
    • Thread