mamut Posted February 9, 2009 Share Posted February 9, 2009 Is it possible to use function ControlSend with NOT TYPING? Explain: $string="Some text" $window=WinGetHandle("[active]") ControlSend($window, "", "", $string) and now function ControlSend doing something like: 1. send "Shit+S" to $window 2. send "o" to $window 3. send "m" to $window 4. send "e" to $window etc... now i want do to do something like this: 1. send "Some text" to $window (NOT TYPING JUST PASTE) PS: Im using ControlSend because it's working even if windows is minimized so keep this in mind and I want solve my problem with ControlSend fucntion because if my PC is busy (CPU) then i have to increase Opt("SendKeyDelay", 500) and now if string is long i have to wait for soooo long. Thanks in advance Link to comment Share on other sites More sharing options...
KaFu Posted February 9, 2009 Share Posted February 9, 2009 (edited) Use controlsend not on windows but on controls. Obtain control id with au3info in Scite. Assume you have an Edit control in the window, something like this might work: ControlSend(WinGetHandle("[active]"), "", "[CLASS:Edit; INSTANCE:1]", "This is some text") Edited February 9, 2009 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
SpookMeister Posted February 9, 2009 Share Posted February 9, 2009 Maybe? ClipPut() ControlSend($window,"","","^V") [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
KaFu Posted February 9, 2009 Share Posted February 9, 2009 Maybe?ClipPut()ControlSend($window,"","","^V") didn't thought that would work, but it does. If the receiving window 'knows' what to do with ^v this is fine, but if you want to paste to a certain control you'll have to obtain the id. OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 9, 2009 Moderators Share Posted February 9, 2009 ControlSetText() if it's just text you're sending. It's much faster. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Andreik Posted February 9, 2009 Share Posted February 9, 2009 Is it possible to use function ControlSend with NOT TYPING? Explain: $string="Some text" $window=WinGetHandle("[active]") ControlSend($window, "", "", $string) and now function ControlSend doing something like: 1. send "Shit+S" to $window 2. send "o" to $window 3. send "m" to $window 4. send "e" to $window etc... now i want do to do something like this: 1. send "Some text" to $window (NOT TYPING JUST PASTE) PS: Im using ControlSend because it's working even if windows is minimized so keep this in mind and I want solve my problem with ControlSend fucntion because if my PC is busy (CPU) then i have to increase Opt("SendKeyDelay", 500) and now if string is long i have to wait for soooo long. Thanks in advanceHope this example helps you: AutoItSetOption("WinTitleMatchMode",2) Run("notepad.exe") WinWait("Notepad") WinActivate("Notepad") DefControlSend("Notepad","","Edit1","This is a test.") Func DefControlSend($TITLE,$TEXT,$CONTROL,$STRING) ClipPut($STRING) ControlFocus($TITLE,$TEXT,$CONTROL) Send("^v") EndFunc When the words fail... music speaks. Link to comment Share on other sites More sharing options...
KaFu Posted February 9, 2009 Share Posted February 9, 2009 ControlSetText() if it's just text you're sending. It's much faster.Nice to know OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
mamut Posted February 9, 2009 Author Share Posted February 9, 2009 ControlSetText() if it's just text you're sending. It's much faster.Doesn't work, it sets window title, not pasting/sendig to window Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 9, 2009 Moderators Share Posted February 9, 2009 Doesn't work, it sets window title, not pasting/sendig to windowTo send the text, you need to send it to the control. You have it blank, of course it's not going to send to anything.Using ControlSend() more than likely sends to the first edit control, or makes sure it's focused if you're not already focusing on it.If it's too slow for you, and Send()/ControlSend() is the only thing working, then you may want to add in the Opt SendKeyDelay to 1 or 0.If it's sending erroneous data, then try using the last parameter of ControlSend() and put 1 there for raw mode. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
ant1885 Posted March 13, 2009 Share Posted March 13, 2009 To send the text, you need to send it to the control. You have it blank, of course it's not going to send to anything.Using ControlSend() more than likely sends to the first edit control, or makes sure it's focused if you're not already focusing on it.If it's too slow for you, and Send()/ControlSend() is the only thing working, then you may want to add in the Opt SendKeyDelay to 1 or 0.If it's sending erroneous data, then try using the last parameter of ControlSend() and put 1 there for raw mode.sorry, may i ask, what if i already do that, using controlsend() with parameter 1, but there are still some error, like suddenly the text that i send become uppercase or like i press shift+character i wan to type.for example, i want send "zero123" with ControlSend($window, "", "", "zero123",1) not somehow it become "zero!@#".can somebody give some solution for this error, please? 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