Sign in to follow this  
Followers 0
arktikk

ControlSend() ENTER key to a Systreeview32

5 posts in this topic

#1 ·  Posted (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 by arktikk

Share this post


Link to post
Share on other sites



Im also curious if I should maybe use postmessage or sendmessage? Im very unfamilar with the functions, though, and sorry to bump this...

Share this post


Link to post
Share on other sites

My last bump. Heres to good advice? :[

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

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. ;)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0