[TxMt] Re: Paste as

Matt Neuburg matt at tidbits.com
Sun May 10 14:46:47 UTC 2015


> On May 10, 2015, at 6:13 AM, Rasmus Malver <rasmus at malver.dk> wrote:
> 
> Hi everybody!
> 
> I'm trying to make an enhanced paste-function which evaluates the text pasted into a blank textmate document, and assigns the document's language accordingly.
> 
> Is there a non-AppleScript way of assigning language? It is very lacking in text examination, so it would be much less clumsy in, say, bash.
> 
> I know I can use this.:
> keystroke "h" using {control down, option down, shift down}
> keystroke "1"
> 
> To set the syntax as HTML by “faking” the keyboard shortcut.
> 

Write it in your favorite scripting language (bash, ruby, whatever) and use `osascript` to fake the keyboard shortcut just as you have it. m.

--
matt neuburg, phd = http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 8! http://shop.oreilly.com/product/0636920034261.do
iOS 8 Fundamentals! http://shop.oreilly.com/product/0636920034278.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html




More information about the textmate mailing list