Tuesday, September 27, 2022

#1 2005-10-12 01:56:35 pm

From:: Malasaña, Madrid
Registered: 2002-11-20
Posts: 2014

What is a "stay open" script?

One way to save a script is as a "stay open application." A stay open script offers the ability to "look" for certain events after a set period of time, or the ability to make a script repeat actions at after some number seconds have elapsed. It shouldn't be hard to realize the potential.

The structure here is using an "on idle" command around the body of the script, with a "return" statement that tells the script how long to wait before running again. Here's an example:


on idle
   tell application "Finder"
       empty -- empties the trash
   end tell
   return 300 -- this is 5 minutes in seconds
end idle

Save this script as a stay open application. When you first double-click it the trash will get emptied, and it will be emptied every 5 minutes after then... Until you quit the script.

Filed under: Finder



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)