![]() |
AppleScript to quit application if idle
Hello All,
I am very new to AppleScript and hope to get some advice. I want to write a AppleScript to quit an application if leaving it idle for 15 minutes. Please also note that the computer may not be in idle. Is it possible only to get idle time for application? In live situation, it works something like this: I am working on my mac and I have a few applications open. I want the script to quit/force quit the application that I leave it for 15 minutes. Similarly I want to do the same with mounted network drive. I want to disconnect network drive if leaving them idle for 15 minutes. Please help. Thanks & Regards, Jeno |
Can I ask why you want to quit idle apps? What's your objective?
|
Over the time, I had try to educate the user at my company to always save their work close the application that they do not need to use anymore. Users always complaining that their workstation are slow even if they are using the best and fully loaded Mac Pro.
There are times where I am getting very frustrated and even want to slap them on their face. Now that it is proven that "nice education" doesn't work. I am going to write a script to force quit/disconnect any application and server. I have done a search on this forum and understand that this is not a good/healthy way, but user need to get educated, I doesn't really care if user lost their work and it doesn't do much damaged to the application itself. I need a way to forcing user to adopt a good habit of always saving job and close down the apps. Thanks & Regards, Jeno |
Sounds like a bad idea. If they lose work because you force-quit an application surely that is worse than a workstation being a bit slow? If the slowness of the workstations is due to poor work habits then I would say step up the education but force-quitting apps is going to create some bad workplace relations.
Sorry, I know you asked for a script not an opinion. Just my 2c. |
Quote:
Quote:
Not a good idea. What exactly is your higher level goal? Are you trying to help the users? Or just stop them from complaining? Or just exert control because you think you should? |
there are much better options here than forcing users to quit their apps. if these are multi-user (public) workstations, redesign your system so that users have to log in and out (maybe with a timer that pops up after 10 minutes of system inactivity and logs them out if they don't respond). that will prevent users from leaving files open on the machine. If these are workstations for individuals, let them do what they want. write an FAQ about using computer resources efficiently, and point anyone who complains to that FAQ.
|
Quote:
Might it be something else? Network accounts? |
I totally understand but apparently the bad user habit has causes the OS or application to crashed most of the time and it happen regularly. This is where I get idea of writing a script to "simulating" the "crash".
|
What is the bad habit that the users have? Leaving apps open is not a bad habit.
Even so, why would you want to simulate a crash: to help your users learn not to cause crashes....?:confused: What do the crash logs indicate might be the cause of the crashes, both for the apps and the OS? |
Education is definitely not going to work. Can anyone please advice me a better way to get this done?
Cheers, |
Maybe I explained it wrong from thee beginning. The main issue is that I am limited to a certain # of license software plug-in Apps. for Illustrator. Every computer has the software plug-in app installed, but I only have a finite # of licenses. When a user logs into the plug-in, does the task at hand, the plug-in remains active. That causes myself and my IT staff to walk around to all of the computers and see who is idle but still connected to thee plug-in. This is what I am looking for and to see if it is possible to write a script that sits in the background, instead of looking at each computer through Apple Remote desktop and see that way. Thanks
|
Quote:
at any rate, my advice would be the same: pick 'x' machines (one for each license that you own); install the app on those and remove it from the others, and then make it so people have to log in and log out to use those machines. |
Quote:
|
Quote:
Since the problem seems to be related to one particular application, it seems that you could just monitor that one app (e.g. with a background script that looks at the CPU time used by that app) and pop up a dialog asking the user to quit the app if it hasn't been used for a while. You can get info on CPU usage via the 'ps' command. |
Quote:
|
Quote:
|
Back in the days I was talking about (now 7 years ago), Novell had server software for managing limited licenses in exactly the way you're describing. I don't know how the software measured "idle" time, but we didn't get complaints so it worked. Bear in mind, however, that the limited license software was not entirely on the user's machine, it was netware. I don't know the details, unfortunately (I was the Dean of the Faculty, not the IT guy).
|
Hello,
Any luck helping me getting this done? |
I can't believe there isn't software available to do it.
|
Quote:
|
The application is Adobe Illustrator CS2 & CS3. The plugin is loaded once the application is launch.
|
well, first draft. take this script, paste it into the script editor and save it as a stay-open application bundle. (you'll also want to play with the info.plist file in the package to give it a non-generic name and make it background only, but that can wait until after it's been debugged). give it permissions so that only admins can run or execute it, put it in an admin folder somewhere so no one messes with it, and run it at startup. it should sit in the background and check once a minute to see if illustrator is the active app, and if it's not the active app for ten minutes it should throw up an alert and quit Illustrator 30 seconds later.
I don't have illustrator to test it on, of course, so you'll have to play with it yourself. code: Code:
property ticsSinceActive : 0 |
improvements. this version checks to see if it's been active in the last ten minutes, and also records the maximum and average cpu for the last ten minutes, and closes the app if either is less than 3%. you can play with the conditions and the %s to suit your tastes.
Code:
property ticsSinceActive : 0 |
Thanks tw,
I'll have a try and see how it goes. Cheers, Jeno |
Quote:
|
| All times are GMT -5. The time now is 02:06 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.