Check if vim is active in terminal

In a macro, I want to check if vim is active before continuing the macro.
Can this be done without an image match, which I tried and is not working :frowning:

  • When matching an image using the 'Find Unique Image on Screen to Variable' script step, if an image is found, what will the variable be set to? A boolean, a string or a number ?

Here’s some AppleScript you can use:

tell application "Terminal" 
  get processes of (first tab of window 1 whose selected is true)
  return result contains "vim"
end tell

Will return true or false depending on if vim is running.

1 Like