Sign in to follow this  
Followers 0
Arterie

Text editing

12 posts in this topic

#1 ·  Posted (edited)

I have a few questions.

1. How do i read a specific line of a Control (e.g. notepad edit window)

1.1 Does ControlGetText takes longer to load the text if its longer?

1.2 Is there another way instead of using ControlGetText and is it any faster? (On Huge Text)

2. How do i insert a string into the above control at a specific line without setting the whole text (ControlSetText) or moving the caret (ControlCommand(EditPaste))?

Regards, Arterie

Edited by Arterie

Share this post


Link to post
Share on other sites



I've done fairly extensive work with edit inputs and here are some of the commands for you to look at in the help file that will do what you need:

_GUICtrlEdit_GetSel

_GUICtrlEdit_GetText

_GUICtrlEdit_InsertText (inserts text at a given character position)

And yes, the longer your text, the longer (albeit I've never had a noticeable delay) it will take for the GetText commands to work. I would recommend working from the extended Edit functions (_GUICtrlEdit_... functions)

There are commands to do all of what you want in there! The help file is your best friend.

-Fett


[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites

oh i thought these commands would only work with the script's gui.

Thanks for the hint :unsure:

Share this post


Link to post
Share on other sites

oh i thought these commands would only work with the script's gui.

Thanks for the hint :>

Hmm. My mind for some reason just assumed you were creating your own GUI. (I don't know why, you plainly said Notepad, haha) I don't have any experience attempting this functions outside of an AutoIt control, so I can't say for certain if it will work or not. My guess is, probably not, so I'm sorry if this ends of being a waste of time. :unsure:

-Fett


[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

Share this post


Link to post
Share on other sites

It's either not working properly or producing error messages.

Further help is appreciated :unsure:

Regards, Arterie

Share this post


Link to post
Share on other sites

I used Au3Info in order to get the Controlhandle of the notepads editbox.

Then i simply use _GUICtrlEdit_AppendText(0x005402F4,"test")

As suggested by fett8802.

But as he added these functions only work for Autoit-guis.

I tryed them for notepad and recieved the error: Invalid window handle 0x000000.

Thats what i meant by saying im only recieving errors.

Share this post


Link to post
Share on other sites

"_GUICtrlEdit_AppendText(0x005402F4,"test")"

Is that your full script you tried?

Thats not going to do much, your not even telling it which window to look at.

Have a look at this just as a simple example.

#include <GuiEdit.au3>

$hwnd = WinActivate("Untitled - Notepad")

$hEdit = ControlGetHandle($hwnd,"","[CLASS:Edit; INSTANCE:1]")

_GUICtrlEdit_AppendText($hEdit, @CRLF & "newtext")

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Still an errormsgbox pops up telling me:

_MemInit: Invalid window handle [0x00000000]

It did activate notepad though

Edited by Arterie

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

The Au3 Window Info says the same

[CLASS:Edit; INSTANCE:1]

If i try it with the handle for the scrite editor window it works oO

Edited by Arterie

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Ok it does work now with notepad. But for other classes the GUICtrlEdit* functions do not work :/

I want to edit [CLASS:wxWindowClassNR; INSTANCE:33] but it wont work. No error it just doesnt edit anything.

Ill make a new thread concerning wxWindowClassNR

Edited by Arterie

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