Sign in to follow this  
Followers 0
bigred

Caret position control.

9 posts in this topic

I have a multi-line textbox that I need to interact with. How do I control the control the caret position without using mouse clicks? Part of the reason I can't use mouse clicks is the window I'm interfacing with will be minimized at times, and can't be maximized/restored.

I need to use EditPaste, and possibly GetCurrentLine.

What I really need is the ability to set it based on line number, or to a corresponding string that I search for. Is this possible?

Share this post


Link to post
Share on other sites



Using straight AutoIt3 (I'm not familiar with EditPaste and GetCurrentLine) I think you could:

- use ControlGetText to read in the entire string

- then as you suggest, parse it yourself and transform the string

- use ControlSetText to "write" it back out to the control

Share this post


Link to post
Share on other sites

Problem there is that the contents of the text box are updated quite rapidly at times. This method could cause new text to be lost.

If I could just say SetCaretPos ("AppName", "", "Class", "Line#") that would be perfect!

Share this post


Link to post
Share on other sites

Problem there is that the contents of the text box are updated quite rapidly at times.  This method could cause new text to be lost.

If I could just say SetCaretPos ("AppName", "", "Class", "Line#") that would be perfect!

<{POST_SNAPBACK}>

Try if you can read the position with ControlCommand and GetCurrentLine/Col, calculate the difference to the position you want and then you could ControlSend the cursor movements to position the cursor.

Share this post


Link to post
Share on other sites

Cyberslug wrote an applet that included this: But I can't remember if it was a text-editor or a context sensitive tooltip displayer (a universal syntax tooltip feature).

Check his posts in Scripts and Scraps, or his library of projects.

Share this post


Link to post
Share on other sites

Trids I'm not sure which post you're talking about. I searched and found these two threads.

http://www.autoitscript.com/forum/index.php?showtopic=2307

http://www.autoitscript.com/forum/index.php?showtopic=3027

Were you replying to sugi's post? If so, I'm not sure his method will work because I can't do mouse clicks. I need the window to be minimized when I set the caret position.

Share this post


Link to post
Share on other sites

Cyberslug wrote an applet that included this: But I can't remember if it was a text-editor or a context sensitive tooltip displayer (a universal syntax tooltip feature).

Check his posts in Scripts and Scraps, or his library of projects.

<{POST_SNAPBACK}>

The closest code I found is this old MetaPad helper util

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

It was just before the GUI development.

I seem to recall an applet that Cyberslug wrote which "looked over your shoulder" while typing into notepad, so that it could popup the syntax of the function you just typed into a script.

So as for interacting with non-active (minimised) windows, I'm not sure. But it might have some ideas for you.

hth :ph34r:

Share this post


Link to post
Share on other sites

So has anyone had any ideas?

I need the ability to control the Caret position and with so many "caret position" dependant functions, there must be a way to control it. No?

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