Hi, I have a command (html output) that will be run frequently to give a status update. Based on it's output, the user will make a change to their code and run it again. But it gets tedious having to click back onto the window every time they run the command.
Is there a way to have my command automatically switch back to the window they've been writing their text in, after displaying the output, so that the output updates, but user focus appears to remain in the editor window?
I hunted through some Applescript for the last hour, but haven't seen anything I could figure out how to use.
I tried recording the command with automator, it gave me
-- Press ⌘` delay 0.232022 set timeoutSeconds to 2.000000 set uiScript to "keystroke "`" using command down" my doWithTimeout( uiScript, timeoutSeconds )
on doWithTimeout(uiScript, timeoutSeconds) set endDate to (current date) + timeoutSeconds repeat try run script "tell application "System Events" " & uiScript & " end tell" exit repeat on error errorMessage if ((current date) > endDate) then error "Can not " & uiScript end if end try end repeat end doWithTimeout
Then I tried placing that in a system call to osascript at the end of my command, but it didn't seem to do anything.