Author Topic: Output absolute value of cursor position?  (Read 1850 times)

Offline 999hippo

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Output absolute value of cursor position?
« on: August 15, 2013, 06:14:38 PM »
Hi.

to output cursor position (line/row) I find:

     output.writeln(ActiveView.Position.Line + " " + ActiveView.Position.pos);

But I really need just the ABSOLUTE value. Is this possible?

Offline alex

  • Developer
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2190
  • Karma: +37/-3
    • HippoEDIT
Re: Output absolute value of cursor position?
« Reply #1 on: August 15, 2013, 10:42:42 PM »
Code: Javascript
  1. var pos = ActiveDocument.TextToAbsolute(ActiveView.Position);

there is some other functions of document you may need:
Code: [Select]
[id(44), helpstring("Convert Text Position to Absolute Position")] HRESULT TextToAbsolute([in] IPosition* pPosition, [out, retval] POS_T *pnAbsolute);
[id(45), helpstring("Convert Absolute Position to Text Position")] HRESULT AbsoluteToText([in] POS_T nAbsolute, [out, retval] IPosition** ppPosition);
[id(50), helpstring("Calculate absolute distance between text positions")] HRESULT AbsoluteDistance([in] IPosition* pStart, [in] IPosition* pEnd, [in, optional, defaultvalue(eCRLFStyleAuto)] eCRLFStyle nLBStyle, [out, retval] POS_T *pnAbsolute);

Offline 999hippo

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: Output absolute value of cursor position?
« Reply #2 on: August 16, 2013, 03:33:46 AM »
Awesome. I have another question, but will post to new thread - as I think it is probably more helpful to others.

Thanks so much for the quick reply!