Pergunta

I have a script that is run from an application (in my case macvim) that performs a certain command in an available Terminal window or opens a new window if terminal is not used

However, if the terminal is open and it has something running in window 1 (e.g. vim), the script just put the command into the buffer.

Is there a way to check whether window 1 has a running application in it?

Here is the script

#!/usr/bin/osascript

tell application "Terminal"
  if (count of windows) is 0 then
    do script "ls"
  else
    #how do I check that window 1 doesn't have a running application?
    do script "ls" in window 1
  end if
end tell
Foi útil?

Solução

Ok, answering my own question. This can be done with

 if window 1 is busy then
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top