was2 Posted July 4, 2013 Share Posted July 4, 2013 Hey ! I was thinking about doing an automated "send" command, with a chosen key, but i cant get it to work with a variable. I've already tried the code of another thread, but that doesnt work either. Do you know how i can get it to work? Link to comment Share on other sites More sharing options...
Blue_Drache Posted July 4, 2013 Share Posted July 4, 2013 show us the code you used and what's the program you're trying to interact with? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
was2 Posted July 5, 2013 Author Share Posted July 5, 2013 show us the code you used and what's the program you're trying to interact with? I'm not trying to interact with a specific program, i want to make a copy-paste program, with an input line where you can type the words you want to send and specify a hotkey. The code i use is the following: $var = GuiCtrlRead($Input1) Send("{" & $var & "down}") sleep(20) Send("{" & $var & "up}") That one doesnt work, neither with single letters and i dont get why... i've also tried those: send($var&{down}) send($var & "{down}") but they didnt work either. Link to comment Share on other sites More sharing options...
water Posted July 5, 2013 Share Posted July 5, 2013 Try: $var = GuiCtrlRead($Input1) Send("{" & $var & " down}") sleep(20) Send("{" & $var & " up}") My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
was2 Posted July 5, 2013 Author Share Posted July 5, 2013 Try: $var = GuiCtrlRead($Input1) Send("{" & $var & " down}") sleep(20) Send("{" & $var & " up}") Thats exactly the code i posted, why should it work now? water 1 Link to comment Share on other sites More sharing options...
Malkey Posted July 5, 2013 Share Posted July 5, 2013 This example might give you a few ideas. Global $var = "" HotKeySet("^!i", "_InputFunc"); Press Ctrl+Alt+i keys to input data in InputBox.(Highlighted text is put in InputBox.) HotKeySet("^!s", "_SendFunc") ; Press Ctrl+Alt+s keys to insert data at blinking cursor position, or; ; Highlight text to be replace then press Ctrl+Alt+s keys. HotKeySet("{ESC}", "_Terminate"); Press Esc key to exit loop (end script) While Sleep(20) WEnd ; Press Ctrl+Alt+i keys Func _InputFunc() Send("^c") ; Copy highlighted text to clipboard. $var = InputBox("Input Data", "Enter data to be send", ClipGet()) EndFunc ;==>_InputFunc ; Press Ctrl+Alt+s keys Func _SendFunc() Send($var) EndFunc ;==>_SendFunc ; Press Esc key Func _Terminate() Exit 0 EndFunc ;==>_Terminate Link to comment Share on other sites More sharing options...
water Posted July 5, 2013 Share Posted July 5, 2013 Did you notice the additional space? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
fede97 Posted July 5, 2013 Share Posted July 5, 2013 From helpfile: [optional] Changes how "keys" is processed: flag = 0 (default), Text contains special characters like + and ! to indicate SHIFT and ALT key-presses. flag = 1, keys are sent raw. So, this does the trick $var = GuiCtrlRead($Input1) Send("{" & $var & "down}", 1) sleep(20) Send("{" & $var & "up}", 1) 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