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.<br>
<br>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?<br>
<br>I hunted through some Applescript for the last hour, but haven't seen anything I could figure out how to use.<br><br>I tried recording the command with automator, it gave me<br><br><br>-- Press ⌘`<br>delay 0.232022<br>
set timeoutSeconds to 2.000000<br>set uiScript to "keystroke \"`\" using command down"<br>my doWithTimeout( uiScript, timeoutSeconds )<br><br>on doWithTimeout(uiScript, timeoutSeconds)<br>    set endDate to (current date) + timeoutSeconds<br>
    repeat<br>        try<br>            run script "tell application \"System Events\"<br>" & uiScript & "<br>end tell"<br>            exit repeat<br>        on error errorMessage<br>
            if ((current date) > endDate) then<br>                error "Can not " & uiScript<br>            end if<br>        end try<br>    end repeat<br>end doWithTimeout<br><br><br><br>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.<br>