Open a new MacVim window with AppleScript 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?
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



Note that the value of the delay command may need to be adjusted for your system, and or additional delay commands may or may not be needed. Adjust values of and or add/remove the delay command(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.