I’m using FastScripts to set hotkeys for various scripts but every ten minutes or so FastScripts stops working properly. I wrote a script that restarts FastScripts every 10 minutes, but it interrupts whatever I’m doing by unselecting whatever window I’m working in. This despite trying to keep the current window on top using “get name of processes whose frontmost is true”.
So here’s the script (oh and btw I’m using TheTime variable in the place of delay b/c delay doesn’t seem to work in Yosemite when you save the script as an app).
on idle
tell application "System Events"
set theFrontmostApp to item 1 of (get name of processes whose frontmost is true)
end tell
tell application "FastScripts"
quit
end tell
tell application theFrontmostApp
activate
end tell
set TheTime to current date
set NewTime to TheTime + (0.05 * minutes)
repeat while (current date) is less than NewTime
delay 0.5
end repeat
tell application "FastScripts"
activate
end tell
tell application theFrontmostApp
activate
end tell
return 600
end idle
Despite using “tell application theFrontmostApp to activate” once the script finishes in unselects whatever app I’m working in.
Any ideas?