Jump to content

Getting line # in word


mlpdx
 Share

Recommended Posts

Is it possible to get the line position of the cursor in a word document?

I wanted to count the number of lines in a Word document. I thought I could do this by doing a loop with sendkeys({DOWN}) and checking the cursor X, Y at each iteration (when Y doesn't increment, I'd hit the bottom of the doc), but it doesn't look like I can get the cursor position. WinCaretPos is returning something else that doesn't change as the cursor moves down the doc, and the mouse coords aren't related to the cursor position either.

Link to comment
Share on other sites

Is it possible to get the line position of the cursor in a word document?

I wanted to count the number of lines in a Word document. I thought I could do this by doing a loop with sendkeys({DOWN}) and checking the cursor X, Y at each iteration (when Y doesn't increment, I'd hit the bottom of the doc), but it doesn't look like I can get the cursor position. WinCaretPos is returning something else that doesn't change as the cursor moves down the doc, and the mouse coords aren't related to the cursor position either.

Probably you need to look at big_daddy's Word UDF.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks, I checked it out... looks like a wrapper around COM access to Word, but nothing that directly can tell me where the insertion point is. Maybe there is some way to do that with COM, but that's outside of my limited knowledge at this point!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...