On Jul 12, 2016, at 2:43 PM, Matt Neuburg matt@tidbits.com wrote:
I'm kind of amazed your script _ever_ worked. You're not even talking to TextMate. And I don't see anything that would make the template text appear in the document; you're just making a kind of "here doc". You're just sort of trusting that the "result" of your script will magically become the text of the document at the right moment.
Just to be more specific, here's an AppleScript that does more the sort of thing you're after:
tell application "System Events" tell application "TextMate" to activate tell application process "TextMate" keystroke "n" using {command down} delay 1 keystroke "h" using {control down, option down, shift down} delay 1 keystroke "1" delay 1 keystroke "<html>" keystroke return keystroke "</html>" end tell end tell
That's not the exact result you're after, but it is the sort of thing you should be doing. m.
-- matt neuburg, phd = http://www.apeth.net/matt/ pantes anthropoi tou eidenai oregontai phusei Programming iOS 9! http://shop.oreilly.com/product/0636920044352.do iOS 9 Fundamentals! http://shop.oreilly.com/product/0636920044345.do RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html