Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Simpler Script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Simpler Script
Authored by: cfoster on Nov 05, '04 01:21:08PM

The following script is just a bit simpler. If LCCDaemon is not running, the first line will cause an exception and it will bounce to "on error", otherwise, it continues to execute and LCCDaemon is launched.

     	try
      	   tell application "Finder" to get name of process "LCCDaemon"
	   tell application "LCCDaemon" to quit
     	on error
	   tell application "LCCDaemon" to activate
     	end try


[ Reply to This | # ]
Simpler Script
Authored by: cfoster on Nov 05, '04 01:24:45PM

Whoops. I mean "it continues to execute and LCCDaemon is quit."

Oh, and a guess you don't really need the "name of..." part of the script. Just 'process "LCCDaemon" is fine.



[ Reply to This | # ]
Simpler Script
Authored by: stephenj on Nov 05, '04 09:27:23PM
The reason I used System Events as it runs separate from the Finder so if the Finder acts funky during fast user switch this script will work...

But yes your script does work as well...
Also one thing to recommend and I forgot to put in the original hint (also forgot to login before I posted it *slaps forehead*):

If you're using an older machine like me (400mhz G3) you might want to put a sleep statement before the activate part. (Do not use wait as it sucks CPU)

something like:
do shell script "sleep 2"

This will make sure the daemon is launched at the proper time aka after everything else and all keys will work.

I spent a little bit of time before figuring out that problem...
Hope my/your script helps everyone...

Once again just for a reminder of the older machine script:

on pscheck()
tell application "System Events"
return (get name of every process)
end tell
end pscheck

tell application "Finder"
set e to my pscheck()
if e contains "LCCDaemon" then
tell application "LCCDaemon"
quit
end tell
else
do shell script "sleep 3"
tell application "LCCDaemon"
activate
end tell
end if
end tell

---
if by chance or circumstance...

[ Reply to This | # ]