On 3/11/07, Todd Ditchendorf itod@mac.com wrote:
TextMate list,
how can I command TextMate to create a new untitled document from a separate process? Basically, I want textmate to create a new window (titled 'untitled n', that does not have a file path associated with it yet.
Peter Jaros wrote:
I would say
$ osascript -e 'tell application "TextMate" to make new document'
but that doesn't seem to work properly. However,
$ osascript -e 'tell application "TextEdit" to make new document'
works for TextEdit. Methinks this is a TextMate bug. Allan?
If "Enable assistive devices" is enabled (see http://www.mactech.com/articles/mactech/Vol.21/21.06/UserInterfaceScripting/...), something like
tell application "System Events" tell process "TextMate" set frontmost to true click menu item "New" of menu "File" of menu bar 1 end tell end tell
should do it. Or as a shell script:
osascript <<APPLESCRIPT tell application "System Events" tell process "TextMate" set frontmost to true click menu item "New" of menu "File" of menu bar 1 end tell end tell APPLESCRIPT