arktikk Posted January 21, 2011 Posted January 21, 2011 (edited) First off I want to say thanks for what an awesome community this is. I have created a few programs and taught myself a decent amount using everything I found in this forum, and I really appreciate it. However, I haven't really seen anything related to my current problem, which is: I'm having a problem using ControlSend() to send the ENTER key to Ventrilo. I set up "Q" as a hotkey, so when I press it, its supposed to select the casually afk channel, which it successfully does. Then it is supposed to hit the enter key to join the channel, which it doesn't successfully perform. I've tested other keys, such as letters and the up/down keys, and they all work when Ventrilo is in the background, but enter doesnt. I've tried using controlsendplus() as well... Is there any way to send the ENTER key to Vent? Or since it's a treeview, does it have to be an active window? Thanks. Heres my current code: #include <GuiTreeView.au3> HotKeySet("q", "test") $in1 = "Ventrilo" $htree = ControlGetHandle($in1, "", "SysTreeView321") $node = _GUICtrlTreeView_FindItem($htree, "casually afk") If $node Then While 1 Sleep(2000) _GUICtrlTreeView_SelectItem($htree, $node) WEnd Else MsgBox(0, 'Error', 'Channel not found') EndIf Func test() ControlSend("Ventrilo", "", "SysTreeView321", "{enter}") EndFunc ;==>test Ive also tried using ControlTreeView() to use ControlSend()...still only works when its the active window. Edited January 22, 2011 by arktikk
arktikk Posted January 22, 2011 Author Posted January 22, 2011 Im also curious if I should maybe use postmessage or sendmessage? Im very unfamilar with the functions, though, and sorry to bump this...
arktikk Posted January 25, 2011 Author Posted January 25, 2011 My last bump. Heres to good advice? :[
Andreik Posted January 25, 2011 Posted January 25, 2011 (edited) This should work, I`m not very sure because I don't have any node in Ventrilo for test. In case that this not work and you want just to expand one node [named:casually afk]you can try instead of send enter key to use _GUICtrlTreeView_ClickItem(). or better _GUICtrlTreeView_SetState() #include <GuiTreeView.au3> HotKeySet("q","SendEnter") HotKeySet("{ESC}","Quit") Global $HWND = WinGetHandle("Ventrilo") $CTRL = ControlGetHandle($HWND,"","SysTreeView321") $ITEM = _GUICtrlTreeView_FindItem($CTRL,"casually afk") If $ITEM <> 0 Then _GUICtrlTreeView_SelectItem($CTRL,$ITEM) While True Sleep(10) WEnd Func SendEnter() ControlSend($HWND,"","SysTreeView321","{ENTER}") EndFunc Func Quit() Exit EndFunc Edited January 25, 2011 by Andreik
arktikk Posted January 25, 2011 Author Posted January 25, 2011 This should work, I`m not very sure because I don't have any node in Ventrilo for test. In case that this not work and you want just to expand one node [named:casually afk]you can try instead of send enter key to use _GUICtrlTreeView_ClickItem(). or better _GUICtrlTreeView_SetState() #include <GuiTreeView.au3> HotKeySet("q","SendEnter") HotKeySet("{ESC}","Quit") Global $HWND = WinGetHandle("Ventrilo") $CTRL = ControlGetHandle($HWND,"","SysTreeView321") $ITEM = _GUICtrlTreeView_FindItem($CTRL,"casually afk") If $ITEM <> 0 Then _GUICtrlTreeView_SelectItem($CTRL,$ITEM) While True Sleep(10) WEnd Func SendEnter() ControlSend($HWND,"","SysTreeView321","{ENTER}") EndFunc Func Quit() Exit EndFunc i appreciate your attempt and help but this method doesnt work. I want it to work when the window is NOT active, and for some reason the enter key only sends when it IS active. I tried _GUICtrlTreeView_SetState($CTRL,$item,$TVIS_EXPANDED ,true) as well, no effect.
HozScr Posted May 25, 2022 Posted May 25, 2022 Hey All, Sorry to resurrect a dead thread, but I had the same issue and found a simple solution. In my case, ControlSend doesn't seem to pass {ENTER} like other functions and actually sends the literal text {ENTER}, in cmd.exe windows at least (Win 10). The trick is to use a carriage return instead, so: ControlSend ( "[CLASS:ConsoleWindowClass]", "", "", @CR,1) Done!
Nine Posted May 25, 2022 Posted May 25, 2022 It is because you are sending it RAW ! That is why it does not work sending "{ENTER}" “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
HozScr Posted May 25, 2022 Posted May 25, 2022 I wouldn't assume that the docs infer that. It mentions special characters to indicate SHIFT and ALT presses. Hitting enter is neither a special character nor does it involve SHIFT/ALT. Perhaps the RAW method would help OP, wherever they are now. FYI https://www.autoitscript.com/autoit3/docs/functions/ControlSend.htm $SEND_DEFAULT (0) = Text contains special characters like + and ! to indicate SHIFT and ALT key-presses (default). $SEND_RAW (1) = keys are sent raw.
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