Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to figure out if there is a way in TextMate that I can send out the code I'm typing on the fly to TextEdit.

Maybe some AppleScript or something, any thoughts? Thanks.

share|improve this question
2  
One question: why? It honestly doesn't make much sense to me as to why someone would want to go from a more powerful editor to a less powerful one. –  Wuffers Aug 2 '11 at 4:22
    
Cmd+A, Cmd+C, Alt-Tab, Cmd+V –  slhck Aug 2 '11 at 8:48
    
@Mark I'm just experimenting with getting live data out of an editor. Sending it to TextEdit is just a simple thing I was asking to find out how it's done. –  acreek Aug 3 '11 at 16:39
add comment

1 Answer

up vote 0 down vote accepted

This is seriously ugly, but works though. Requirements:

  • Both TextMate and TextEdit need to be running
  • Both need a document open in front

What it does is simply select all, copy, and paste over the TextEdit window.

tell application "TextMate"
  activate
  tell application "System Events"
    keystroke "a" using {command down}
    keystroke "c" using {command down}
  end tell
end tell

tell application "TextEdit"
  activate
  tell application "System Events"
    keystroke "a" using {command down}
    keystroke "v" using {command down}
  end tell
end tell

share|improve this answer
    
Sorry for the formatting, it seems that the editor engine does not like the AppleScript for whatever reason. –  slhck Aug 2 '11 at 9:11
    
Thanks slick I appreciate the help! –  acreek Aug 3 '11 at 16:41
    
@acreek Not a thing -- btw this is not the way you usually want to do stuff like this. If you're trying to learn AppleScript you should access the text objects of the TextMate window, rather than fiddling around with copy/pasting and emulating keypresses. –  slhck Aug 3 '11 at 19:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.