|
|
#1 |
|
Prospect
Join Date: May 2009
Posts: 8
|
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 |
|
|
|
|
|
#2 |
|
MVP
Join Date: Aug 2006
Posts: 2,281
|
Can I ask why you want to quit idle apps? What's your objective?
|
|
|
|
|
|
#3 |
|
Prospect
Join Date: May 2009
Posts: 8
|
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 |
|
|
|
|
|
#4 |
|
MVP
Join Date: May 2004
Location: Melbourne, AUS
Posts: 1,415
|
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.
__________________
:') |
|
|
|
|
|
#5 | ||||||||||||||||||||||||||||||||||||||||||
|
Moderator
Join Date: Jan 2002
Location: Montreal
Posts: 29,452
|
And what evidence do you have that the slowness (real or apparent) is due to having extra apps running that aren't being used? (This doesn't seem like a likely reason for slowness.)
So in order to "educate" your users, you are going to make them lose some data (things they have worked on but not yet saved) ?!? 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?
__________________
hayne.net/macosx.html |
||||||||||||||||||||||||||||||||||||||||||
|
|
|
|
|
#6 |
|
Hall of Famer
Join Date: Apr 2007
Posts: 3,342
|
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.
__________________
Philosophy is a battle against the bewitchment of our intelligence by means of language. -LW- |
|
|
|
|
|
#7 | |||||||||||||||||||||||
|
MVP
Join Date: Aug 2006
Posts: 2,281
|
If the Macs are fully loaded with RAM, then having idle apps is probably not the cause of the slowness. Might it be something else? Network accounts? |
|||||||||||||||||||||||
|
|
|
|
|
#8 |
|
Prospect
Join Date: May 2009
Posts: 8
|
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".
|
|
|
|
|
|
#9 |
|
MVP
Join Date: Aug 2006
Posts: 2,281
|
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....? ![]() What do the crash logs indicate might be the cause of the crashes, both for the apps and the OS? |
|
|
|
|
|
#10 |
|
Prospect
Join Date: May 2009
Posts: 8
|
Education is definitely not going to work. Can anyone please advice me a better way to get this done?
Cheers, |
|
|
|
|
|
#11 |
|
Prospect
Join Date: May 2009
Posts: 8
|
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
|
|
|
|
|
|
#12 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Apr 2007
Posts: 3,342
|
That's confusing. software licenses are for the installation, not the use: if you have 12 machines and 3 licenses that means you can install the app on 3 machines. installing it on all 12 is illegal, even if no one ever uses it. 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.
__________________
Philosophy is a battle against the bewitchment of our intelligence by means of language. -LW- |
|||||||||||||||||||||||
|
|
|
|
|
#13 | |||||||||||||||||||||||
|
Moderator
Join Date: Jan 2002
Location: Montreal
Posts: 29,452
|
No - it is quite common to have "floating licences" where you can install the software on as many machines as you want, but only a specified number can use the software at a given time - usually controlled by a licence server on the network. It would seem that this is the situation jeno has.
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#14 | |||||||||||||||||||||||
|
Moderator
Join Date: Jan 2002
Location: Montreal
Posts: 29,452
|
Indeed it would have been a good idea to have explained the real problem from the beginning. Now it is clear. 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.
__________________
hayne.net/macosx.html |
|||||||||||||||||||||||
|
|
|
|
|
#15 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 3,517
|
This is precisely the way in which limited licenses for expensive image editing and CAD software were controlled at the university from which I'm retired. A network server controlled that and it did indeed monitor usage because students would often run a limited app just to save their access to it later. The server had a "Use It Or Lose It" script, too, that started with a 10-minute warning and ended with a shutdown of the software.
__________________
PPC dual-core G5/2.3, OS X 10.5.8; 17" MBP Core 2 Duo/2.6, OS X 10.6.2; VMWare Fusion->Win XP |
|||||||||||||||||||||||
|
|
|
|
|
#16 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Apr 2007
Posts: 3,342
|
well, what an odd way of doing things. if that's the way it works, though, then there's a couple of approaches to the problem:
__________________
Philosophy is a battle against the bewitchment of our intelligence by means of language. -LW- |
|||||||||||||||||||||||
|
|
|
|
|
#17 |
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 3,517
|
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).
__________________
PPC dual-core G5/2.3, OS X 10.5.8; 17" MBP Core 2 Duo/2.6, OS X 10.6.2; VMWare Fusion->Win XP |
|
|
|
|
|
#18 |
|
Prospect
Join Date: May 2009
Posts: 8
|
Hello,
Any luck helping me getting this done? |
|
|
|
|
|
#19 |
|
Hall of Famer
Join Date: Oct 2002
Location: Halifax, Canada
Posts: 3,517
|
I can't believe there isn't software available to do it.
__________________
PPC dual-core G5/2.3, OS X 10.5.8; 17" MBP Core 2 Duo/2.6, OS X 10.6.2; VMWare Fusion->Win XP |
|
|
|
|
|
#20 | |||||||||||||||||||||||
|
Hall of Famer
Join Date: Apr 2007
Posts: 3,342
|
Jeno, read my last post and answer the questions. and at least tell us what application you're talking about. is it illustrator itself you want to quit, or a particular plugin?
__________________
Philosophy is a battle against the bewitchment of our intelligence by means of language. -LW- |
|||||||||||||||||||||||
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|