Force Quit an App with Hazel/AppleScript/Shell Script

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Hello everybody,

I have a Mac at home which runs TeamViewer. Sometimes the program crashes but doesn't close.
I would need to Force Quit it, but as the program itself is the remote program to control my second Mac, I can not force quit it. I would like to use Hazel and Dropbox to do so.

In my dropbox folder I have a random file with a random name. But if I change the name to i.e. "QuitTeamViewer" Hazel should run a script which Force Quit the App TeamViewer.

I got some help and actually this script should do the trick:

do shell script "killall TeamViewer"

So I made the rule with AppleScript like:

If there is a file with the name "QuitTeamViewer" - run AppleScript with code 'do shell script "killall TeamViewer"'

But it doesn't work.

Does anybody has an idea. I have not worked properly with AppleScript nor Shell Scripts, so I don't even know if I embeded it correctly.

Thank you in advance.
restfulsilence
 
Posts: 8
Joined: Sun Jan 08, 2012 11:27 am

First off, if all you are doing is running a shell script, no need to wrap an AppleScript around it. Just do a shell script with the stuff in quotes.

Not sure why it isn't working. Try entering that command in Terminal and see if that works. Also, check Hazel's logs to see if there was any error running the script.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

No it is working. The little thing which caused an error was:

killall -KILL TeamViewer

instead of

killall TeamViewer

Thanks anyway! :)
restfulsilence
 
Posts: 8
Joined: Sun Jan 08, 2012 11:27 am


Return to Support