Xenobiologist Posted February 27, 2008 Share Posted February 27, 2008 (edited) Hi,I did post in support forum, but I didn't get an answer, that is why I try again here. Link : Topic in supportOpt('WinTitleMatchMode', 4) Run("notepad.exe") WinWait("classname=Notepad") ControlSetText("classname=Notepad", "", "Edit1", "1@ " & "{ASC 064}" & @CRLF) ; sends @ {ASC 064} and Cursor stays at first pos. ControlSend("classname=Notepad", "", "Edit1", "2@ " & "{ASC 064}" & @CRLF) ; sends @ @ ControlSend("classname=Notepad", "", "Edit1", "3@ " & "{ASC 064}" & @CRLF, 1) ; sends @ {ASC 064}ControlSetText seems to always set text raw comparing it to ControlSend. Additionally the cursor stays at first position after ControlSetText (is this the way it should be?) Is this already documented?Besides, ...the examples of ControlSetText and ControlSend should be changed to a NON-English example. (Using classname in lieu of title) or it should be pointed out.Thanks! Mega Edited February 27, 2008 by Xenobiologist Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Administrators Jon Posted February 27, 2008 Administrators Share Posted February 27, 2008 Hi, I did post in support forum, but I didn't get an answer, that is why I try again here. Link : Topic in support Opt('WinTitleMatchMode', 4) Run("notepad.exe") WinWait("classname=Notepad") ControlSetText("classname=Notepad", "", "Edit1", "1@ " & "{ASC 064}" & @CRLF) ; sends @ {ASC 064} and Cursor stays at first pos. ControlSend("classname=Notepad", "", "Edit1", "2@ " & "{ASC 064}" & @CRLF) ; sends @ @ ControlSend("classname=Notepad", "", "Edit1", "3@ " & "{ASC 064}" & @CRLF, 1) ; sends @ {ASC 064} ControlSetText seems to always set text raw comparing it to ControlSend. Additionally the cursor stays at first position after ControlSetText (is this the way it should be?) Is this already documented? Besides, ... the examples of ControlSetText and ControlSend should be changed to a NON-English example. (Using classname in lieu of title) or it should be pointed out. Thanks! Mega ControlSetText doesn't do simulated keystrokes it just sets the exact text as written. The order you should attempt to automate the text in a control is: 1. ControlSetText 2. ControlSend - keystroke sim 3. Send - keystroke sim Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 27, 2008 Author Share Posted February 27, 2008 ControlSetText doesn't do simulated keystrokes it just sets the exact text as written. The order you should attempt to automate the text in a control is:1. ControlSetText2. ControlSend - keystroke sim3. Send - keystroke simHi Jon,thanks for that. One question left. The cursor stays at first position after ControlSetText. Is this your intention, or is it just because the control doesn't recognize the keystrokes?Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Valik Posted February 27, 2008 Share Posted February 27, 2008 There are no keystrokes sent with ControlSetText() so it doesn't recognize keystrokes because they don't exist. Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 27, 2008 Author Share Posted February 27, 2008 There are no keystrokes sent with ControlSetText() so it doesn't recognize keystrokes because they don't exist.Thanks, that what I tried to put in words above. So, ControlSetText is always True(Success) or False? - what I mean is Send and even ControlSend can be breaked during execution and ControlSetText can be, right? Are there any other reasons why ControlSetText is "better" than ControlSetText?Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Administrators Jon Posted February 27, 2008 Administrators Share Posted February 27, 2008 ControlSetText literally sends a native windows message to a control which says "please change your text to this". If it works on a control it is 100% reliable. Both Send and ControlSend are imperfect and not 100% reliable as they use simulated keystrokes that can go wrong/be interrupted. ControlSetText does not use keystrokes, is instant and cannot be interrupted. Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 27, 2008 Author Share Posted February 27, 2008 ControlSetText literally sends a native windows message to a control which says "please change your text to this". If it works on a control it is 100% reliable. Both Send and ControlSend are imperfect and not 100% reliable as they use simulated keystrokes that can go wrong/be interrupted. ControlSetText does not use keystrokes, is instant and cannot be interrupted.Thanks! That's what I wanted to here and I what I expected. Great. Nice to learn such things.Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
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