Sign in to follow this  
Followers 0
mlpdx

Getting line # in word

3 posts in this topic

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.

Share this post


Link to post
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.

Share this post


Link to post
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!

Share this post


Link to post
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
Sign in to follow this  
Followers 0