tags:

views:

39

answers:

1

Hi,

I'd like to write a XCode user script which, let say, open the current file in another editor. But it seems that the only things which can be passed as argument (actually, as stream input) are:

  • the current election
  • the whole content of the current document

Is there any way to access other information like:

  • current filename
  • current cursor position
  • ...

Thanks

+1  A: 

The current filename is passed through %%%{PBXFilePath}%%%.

The selection start, which is passed through %%%{PBXSelectionStart}%%%, returns the cursor position (as character index) when there is no selection so you should be able to use that.

If you need the line number instead, it should be possible to get it from the index with some scripting (like counting the characters in the full text while keeping track of new lines).

Rhult
That's working, thank you very much!