I can open a new iTerm window like this:
tell application "iTerm" create window with default profile end tell
How do I do the same but with MacVim?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
To open a new window in MacVim, you can use the following example AppleScript code:
tell application "MacVim" activate delay 1 end tell tell application "System Events" keystroke "n" using command down end tell
delaycommand may need to be adjusted for your system, and or additional
delaycommands may or may not be needed. Adjust values of and or add/remove the
delaycommand(s) as appropriate.
Note: The example AppleScript code is just that and does not employ any error handling and is meant only to show one of many ways to accomplish a task. The onus is always upon the User to add/use appropriate error handling as needed/wanted.
tell application "System Events" set currProcs to (name of processes) set MacVimRunning to (currProcs contains "MacVim") if not MacVimRunning then tell application "MacVim" to activate end if tell process "MacVim" click menu item "New Window" of menu "File" of menu bar 1 set visible to true end tell end tell