문제

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
도움이 되었습니까?

해결책

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

 if window 1 is busy then
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top