I have been writing a little app that lists text files. When I double click the NSTableView containing the file name I want it to open in TextMate, place the caret on a specific line and scroll down to that line, just like for example xcode does when double clicking in the error list. Is there some way to accomplish this (preferably from Cocoa)? I don`t have any problems opening the file in TextMate. Its the caret positioning that is getting to me.
Joachim
On Jan 29, 2005, at 2:16, Joachim Mårtensson wrote:
[...] I want it to open in TextMate, place the caret on a specific line and scroll down to that line, just like for example xcode does when double clicking in the error list. Is there some way to accomplish this (preferably from Cocoa)?
Xcode is using a subset of Metro Works external editor API which TextMate supports: http://codingmonkeys.de/techpubs/externaleditor/pbxexternaleditor.html
Basically you need to send it an 'odoc' apple event with an extra keyAEPosition parameter.
An example of sending the event from Cocoa (but w/o this extra parameter) can be found here: http://gusmueller.com/odb/
At 6:40 AM +0100 1/29/05, Allan Odgaard wrote:
[...] I want it to open in TextMate, place the caret on a specific line and scroll down to that line, just like for example xcode does when double clicking in the error list. Is there some way to accomplish this (preferably from Cocoa)?
Xcode is using a subset of Metro Works external editor API which TextMate supports: http://codingmonkeys.de/techpubs/externaleditor/pbxexternaleditor.html
Basically you need to send it an 'odoc' apple event with an extra keyAEPosition parameter.
An example of sending the event from Cocoa (but w/o this extra parameter) can be found here: http://gusmueller.com/odb/
Is there some standard way to send these kinds of events from the shell?
- Eric
On Jan 29, 2005, at 7:27, Eric Hsu wrote:
Basically you need to send it an 'odoc' apple event with an extra keyAEPosition parameter. [...]
Is there some standard way to send these kinds of events from the shell?
I _think_ you can do it with osascript. But I'd be the last person to tell you how! ;)