Run script after period of inactivity

I'd like to run an apple script after a certain period of inactivity (say 10 minutes). is there a way to do that?

Sample code:
property iRun : 0 -- Global variable (retains latest value between applet executions).
on run
set iRun to 0 -- Clears global variable.
say "Working" -- Optional, your code here.
end run
on idle {}
if (iRun > 0) then -- Do not execute code immediately, instead wait until after delay time.
say "Processing" -- Your code here.
end if
if (iRun = 1) then quit -- Optional code, to quit after processing use code, after a single delay period.
set iRun to 1 -- Needed to guarantee that code is processed after delay period.
return (60 * 10) -- Where '10' indicates 10 minutes.
end idle

Similar Messages

  • I keep losing my wireless connection after periods of inactivity - any solution? I recently installed a new wireless router with improved range.

    I recently installed a Netgear Wireless router for improved reception, but now my macbook loses connection through Airport after periods of inactivity.  We have another older Macbook in the house, and it never loses connection.  I never had this problem with the previous Linksys router, just limited range.  Any ideas what is causing this?  It's frustrating to have to frequently shout down and re-boot.  That so far is the only way I can re-connect.

    Adjust the Wireless Settings on your linksys router...
    Open an Internet Explorer browser page.In the address bar type - 192.168.1.1
    Leave username blank & in password use admin in lower case...
    For Wireless Settings, please do the following : -
    Click on the Wireless tab on the Setup page- Here Wireless Network mode should be mixed- Provide any non linksys network name ....
    Name (SSID) box- Set wireless channel to 11- And wireless SSID broadcast should be Enabled and then click on "Save Settings" >>
    Click on the Sub tab under Wireless > Wireless Security...
    Change the Wireless security mode to WPA, For Encryption, select AES...For Passphrase input your desired WPA Key. For example , MySecretKey , This will serve as your
    network key whenever you connect to your wireless network.
    Do NOT give this key to anyone.
    Click on Advanced Wireless settings>>
    Change the Beacon Interval to 75 >>Change the Fragmentation Threshold to 2304 Change the RTS Threshold to 2304 >>Click on "Save Settings" ...
    Try to look for the Wireless Network on your laptop and attempt to connect...

  • MacBook Pro shuts down after periods of inactivity

    I had a 6-year old MacBook Pro.  Besides just being a bit old and tired it would attempt to shut down after periods of inactivity.  I tried setting it to never sleep.  I tried the whole reset thing where you take the battery out and hold the power button for 5 seconds.  I bought new memory for it.  Eventually I used it as an excuse to buy a new machine.
    Of course I copied my image over to the new MacBook.  Now I know its not a hardware issue because it still happens!
    I also have other quirky issues (probably not related, but who knows). 
    I just cannot get my remote (or any apple remote to work).
    I have an empty folder that I can't delete–it crashes the system.
    Aperature hangs up all the time
    VMware hangs up all the time
    Firefox and Chrome both hang up
    Sometimes I have to force quit Mail
    Is this a good time to do a clean install?

    Resetting the SMC doesn't seem to have done anything. The progress bar hasn't reached the end to shut down yet, but so far, it's displaying the same behavior.

  • Applications closing after period of inactivity

    My applications are closing after a period of inactivity. I would appreciate any help. I'm on a 27inch iMac late 2013 running 10.10.1.
    If application is idol for some time it can close on me. Skype closes often. Adobe products and mamp will close periodically as well. This really interrupts my work flow. Any help would be much appreciated.

    Hello neverask333,
    Thanks for using Apple Support Communities. Based on what you stated, it sounds like multiple programs close on their own. I would recommend that you read this article, it may be able to help the issue.
    OS X Yosemite: If an app freezes or quits unexpectedly
    Thanks for using Apple Support Communities.
    Have a nice day,
    Mario

  • Run script AFTER boot

    I want to run a non-ending script after boot. And I still want to be able to login. So adding the script to rc.local won't fix my problem since the boot process won't finish so that I can login.
    Adding the script to "dillons" cron doesn't seem to work either since you cant specify @boot in it. And setting "* * * * *" will result in 1 minutes wait before the script runs.
    Does anyone have any good ideas to solve my problem?

    as mentioned you can background it in rc.local, or you can create a custom /etc/rc.d file which will make it a daemon just like any other.  there are templates or just copy some existing simple one.  i created one for dropbox which is available on the wiki if you'd like to use it as a guide.
    /edit.  whoops; took too long to craft that response.  ignore me.
    Last edited by brisbin33 (2009-06-25 14:16:28)

  • Set auto shut down for iPod touch after period of inactivity

    I keep falling asleep with my iPod on. My old MP3 player had a setting where it automatically shutdown after a specified period of inactivity. Is there a download or setting of some sort that will make the ipod touch do the same?

    I can't try it out for you now and don't know if it's on 2.x, but read p. 32 of the IPT manual under Sleep Timer. The option is under the Clock -> Timer on the Home menu. If the feature is still there...
    Here's a link to the online manual:
    [http://manuals.info.apple.com/en/iPodtouch_FeaturesGuide.pdf]

  • Disconnect Bluetooth Device After Period of Inactivity

    I have connected a bluetooth device successfully, and it remains paired through power cycles. I'm attempting to now get the device to disconnect after a certain period of inactivity. The device is a ps3 controller, if that matters.
    Any advice?

    Sorry,
    HP 8600 Pro e
    Windows XP SP3
    IE8
    Computer->Router->DSL Modem->Internet
    Assigned  IP address on Computer
    Reserved IP address on Printer
    I guess I could also solve the problem by attaching the WIRELESS printer with a cable to the router, but HP is selling thise products as wireless, so why should I have to do that?

  • Time Machine Service - Run scripts after backup

    I am running Mavericks Server (10.9.5), server version 3.2.2
    The server is used as a backup destination for a lot of Macs, and I am trying to create a complementary service that keeps track of all of the incoming backups and logs all backup events.
    Is there any way to have a script execute whenever the Time Machine service completes a backup, or for that matter, and way to tell when a backup is running or has completed?
    The options I have thought of so far are:
    1. Script that monitors the logs to look for appropriate events
    2. Run script on timer that scans the backup folder and looks for new backups
    Neither of these seems ideal to mean, so I was hoping someone might have a better idea.
    Thoughts?

    In order to back up the configuration and state of some services the server needs them to termporarily be turned off.  This includes the backing up of Time Machine.
    So in order to back up the Time Machine configuration and details about what computers it is backing up where, the server would need to turn off the Time Machine backup service.  But if it's turned off, it can't use it to back things up.
    Similarly, imagine you needed to restore the backup.  To view the backups you would need the Time Machine backup service to be working.  But you can't overwrite the configuration and status information of a service which is turned on, because that would confuse the process doing the serving.  But if the process is turned off, you can't use it to restore the backup.
    So do what Linc said: use the System Preferences panel to back the computer up, and don't back it up to the same device you're backing up its Time Machine clients to.

  • Sun Rays with VDI 3.1 - Black screen after periods of inactivity

    Running VDI 3.1 with bundled versions of SRSS on three servers in a cluster running Solaris 10 with VSphere as a desktop provider - also using meta-kiosk with all smartcards configured to run "VDA" script when inserted, DTUs require registered cards.
    Bit of a strange issue that is unfortunately not always reproducible:
    After what seems a random period after having removed a smartcard from a DTU (if still logged into a Windows session, or after disconnecting it) sometimes as short as 20mins, sometimes only after overnight, upon reinserting the card, the VDI login screen does not always appear immediately (as should happen), but instead a black screen with a moveable mouse pointer is shown. This persists for almost exactly 2 minutes whenever it happens, then the VDI screen appears. If you manually kill the session from the admin web-interface and power-cycle the Sun Ray, it will pop up immediately as expected.
    At times, the VDI screen does simply appear immediately as expected, at others this 2-minute black screen first...
    You can often force the behaviour on a working VDI login screen by choosing "More options - Quit" - this will often trigger the black screen/2 minute delay. At other times quitting in this manner does not reproduce the error and the VDI login screen appears immediately.
    I've researched this for a couple of weeks, and a lot of bugs mentioning "black screens" pointed towards problems with uttsc-bin - I've already applied the patch here: http://sunsolve.sun.com/search/document.do?assetkey=1-21-143215-03-1 to no avail.
    I assume that it possibly is nothing to do with the Windows connector, since it's really the VDI login screen that is not appearing in a timely manner and Windows logins/sessions always start/resume immediately after logging in from the VDI screen.
    Can anyone offer any help?

    Never figured out what was causing this, but an upgrade to VDI 3.2 has fixed it (for now at least!)

  • Run script after home directory mounts??

    Does anyone know if there is a way to run a script when a user logs in that will run after the users home directory mounts. Currently a user logs in, the script runs via a login hook then the home directory mounts. I need the home directory to mount first then the script to run. The users are authenticating to active directory. Please help!!!

    Any resources on how to write a launchd script? Here's what my applescript looks like. I'd like to convert this to launchd so it will run after the home directory mounts:
    tell application "Finder"
    mount volume "smb://server05/assignments$"
    end tell
    tell application "Finder"
    mount volume "afp://Macapps:[email protected]/MacApps"
    end tell

  • Tour will not turn back on after period of inactivity

    Hello,
    My Tour will not turn on after about 2 weeks of inactivity. The battery was stored in it at appx 40% (I realize this was probably a mistake...).
    When plugged into the charger, the red light goes on for appx 10 secs, then turns off (whether battery is in or out).
    Several battery pulls have not made a difference.
    Phone has been plugged in for over an hour now, with no result.
    Tried putting the battery in with the phone plugged/unplugged.
    Plugging phone into PC USB tries to install the drivers (so it's def not fried)
    Thank you in advance for ANY help
    Wesley

    Yes I was going to suggest the same thing. Either place a friend's in your device or take it into your carrier's store to see if another battery does the trick
    If someone has been helpful please consider giving them kudos by clicking the star to the left of their post.
    Remember to resolve your thread by clicking Accepted Solution.

  • Cannot prevent display from dimming after period of inactivity

    once again, another weird unexplainable problem that has been discussed on here but never quite solved. this has nothing to do with the ambient light sensor or the "pass your hand over the speaker grill" situation.
    the problem is that my screen dims after about 2 minutes of inactivity. I've got the "reduce screen brightness before sleep" UNchecked, and the "adjust brightness as ambient light changes" is also UNchecked. I've made these settings for both the power adapter and the battery. I don't see any reason why the screen should dim unless I've checked the option to make it do so.
    any ideas?

    I found this:
    http://www.technodaddy.com/wp/2005/07/24/mac-tip-how-to-stop-tiger-from-half-dim ming-your-screen/
    which I tried, and it worked. however, when I listed the current state (according to the directions) it was already at 0 (zero) but I did the command as directed and it doesn't dim any more.
    cheers!
    15" powerbook (new version) Mac OS X (10.4.3) 100 GB 7200 rpm hd

  • Run script after Network turns off

    Hi all,
    i have a problem with my Network which will not reconnect after suspend or when it is turned off by hardware switch. I already figured out that the problems do not appear when wpa_supplicant is killed right before suspend/hardware switch.
    So, what i now want to do is, to kill wpa_supplicant when suspend/hardware switch is used and right after network stops. The Problem is: I have no clue about how to achieve this.
    I read a bit about systemd and service-files in the wiki but I'm not really sure how to implement this (especially which targets etc. i should use)!
    Thanks for your help!
    Last edited by FatRhombus (2014-07-18 17:38:26)

    Not an answer since I couldn't slightly understand what you were saying but considering it is a laptop, and not tweaked for the subject, TLP is a software that can disable and enable your wifi card before suspend, non-activity for a period or enable after waking up, powering on et alii. It has a commenting configuration file and well documented in wiki. Maybe you should try it.

  • WiFi is always disabled after period of inactivity

    When my ZTE One (orange) sits idle for a while, WiFi is always disabled when I wake up the phone. I re-enable WiFi & everything is fine, but I shouldn't have to do that each time.

    Hi!
    If the signal strength is not powerful enough to receive a connection for a period of time the Wi-Fi will disconnect and eventually disable itself. <br> Although, if there is a Wi-Fi network recognized but the phone is inactive the phone will disconnect and this is to save you battery power, but once you wake the phone, the phone should automatically connect back to Wi-Fi if the network is in range and if the signal is good.
    Should you have any more questions regarding this, please feel free to ask.
    Thanks!
    -Andrew

  • Laserjet 300 color MFP nw STOPS SEEING NETWORK after period of inactivity

    I work in an office of a television show. We are all on Macs. Printer worked fine for a while, now has an annoying problem. 
    IF we turn it on, it prints fine for a while and the printer IP is seen by my browser. BUT, if you wait an indefinite amount of time (not sure how many minutes/hours), THEN try to print or access the printer IP... the connection fails. 
    I've updated the fimware. I've disabled IPv6. I've created a static IP address for the printer, re-added the printer using the IP address-- all to no avail. Each time, after an unspecificed amout of time... the printer seems to DROP from the wireless network, which requires users to turn it off, then on so that it can be seen by the network. 
    PLEASE SOMEBODY tell me that it's a simple setting and not the network card failing... !

    Hi BenjaHa,
    Welcome to the HP Forums.
    To get your issue more exposure I would suggest posting it in the commercial forums since this is a commercial product. You can do this at Commercial Forums.
    Thanks for your time.
    Cheers, 
    Click the “Kudos Thumbs Up" at the bottom of this post to say “Thanks” for helping!
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    W a t e r b o y 71
    I work on behalf of HP

Maybe you are looking for

  • How to hide net value of $0 on Credit Memos from rejected return?

    We are creating a credit memo request with a second line item which contains rejected returns.  Basically line item 1 contains the actual qty which we are refunding and line item 2 is the qty which we will not be refunding.  When we create the the cr

  • How do you transfer from address book to outlook 11

    please help, ive done 12442334 things and al come out wrong or ********.

  • Open/ Save files in PS CC

    Hi Photoshop is not able to open files, and not able to save files either. It keeps reverting back with a error message: Not possible due to a program error. Im running Lr Ps and Bridge on a brand new MacPro. What is wrong?

  • HT201317 Privacy concerns having files transferred from old Mac to new Mac.

    I am buying a new Mac. I was told that all of my files and photos on my old Mac could be transferred to my new Mac if I left both Macs at the Apple Store for a couple of days. To be honest, I am concerned about privacy issues. Is there is a way to re

  • Zen micro photo doesn't st

    Hi, when i started my zen micro photo the logo creative appear and the screen didn't change anymore. I Try to shut it down but all the button aren't responding. I plug it to my computer nothing change. Then I remove the batterie now the screen is bla