Monday, May 22, 2017

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

julifos
Administrator
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:

Applescript:

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

Offline

 

Board footer

Powered by FluxBB

[ Generated in 0.035 seconds, 10 queries executed ]

RSS (new topics) RSS (active topics)