Arterie Posted May 16, 2011 Posted May 16, 2011 (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 May 16, 2011 by Arterie
fett8802 Posted May 16, 2011 Posted May 16, 2011 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]
Arterie Posted May 16, 2011 Author Posted May 16, 2011 oh i thought these commands would only work with the script's gui. Thanks for the hint
fett8802 Posted May 16, 2011 Posted May 16, 2011 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. -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]
Arterie Posted May 16, 2011 Author Posted May 16, 2011 It's either not working properly or producing error messages. Further help is appreciated Regards, Arterie
JohnOne Posted May 16, 2011 Posted May 16, 2011 It's either not working properly or producing error messages.Well which is it?and what are the errors. and wheres your script giving the errors? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Arterie Posted May 16, 2011 Author Posted May 16, 2011 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.
JohnOne Posted May 16, 2011 Posted May 16, 2011 "_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.
Arterie Posted May 16, 2011 Author Posted May 16, 2011 (edited) Still an errormsgbox pops up telling me: _MemInit: Invalid window handle [0x00000000] It did activate notepad though Edited May 16, 2011 by Arterie
JohnOne Posted May 16, 2011 Posted May 16, 2011 Did you check the class of the edit control, maybe its different for other OS. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Arterie Posted May 16, 2011 Author Posted May 16, 2011 (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 May 16, 2011 by Arterie
Arterie Posted May 17, 2011 Author Posted May 17, 2011 (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 May 17, 2011 by Arterie
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now