Sign in to follow this  
Followers 0
syno

Using 'Send' to drop down list

4 posts in this topic

Hi guys

Just a quick one....I hope. A friend advises me you cannot use the send command, for example:

Send("{tab}")

To a drop down box...Is this correct? If so how do I do this to a drop down box..

Thank you

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Hi there

Thanks for your help..I have tried a few things but do not really know whether I am using these commands correctly. I have tried both:

Run('C:\AppTool.exe')
Local $iSysTrayApp = ControlGetHandle('[Class:ThunderRT6FormDC]', '', '[Class:DTPicker20WndClass;Instance:1]')
_GUICtrlComboBox_ShowDropDown($iSysTrayApp, True)

and

Run('C:\AppTool.exe')
ControlCommand('[Class:ThunderRT6FormDC]', '', 'DTPicker20WndClass', 'ShowDropDown', '')
   If @error Then
        MsgBox(16, 'Error', 'Abatec drop down list not found')
        Exit
    EndIf

As I say I do not really know wheather the syntax is right....as I am only a noob but I can't see why these two code snippets would not work. I am trying to show a drop down box in an application when launching..

Thanks

Edited by syno

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Hi guys

I now have the following code working and I will need to use ControlFocus as opposed to ControlCommand. The code below works:

WinWait("AppTool", "")
If Not WinActive("AppTool", "") Then WinActivate("AppTool", "")
WinWaitActive("AppTool", "")

ControlFocus("[CLASS:ThunderRT6FormDC]", "", "[CLASS:DTPicker20WndClass;INSTANCE:1]")
   If @error Then
        MsgBox(16, 'Error', 'AppTool drop down list not found')
        Exit
    EndIf

However when I add it to a piece of code I am using that double clicks the AppTool to open from the SysTray it does not work, i.e

#Include <GuiToolBar.au3>
#include "SysTray_UDF.au3"

Global $hSysTray_Handle 
Global $iSystray_ButtonNumber

Global $sToolTipTitle = "daily" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here

$iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)

If $iSystray_ButtonNumber = 0 Then
    MsgBox(16, "Error", "Icon not found in system tray")
    Exit
Else
    Sleep(500)
    _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "left", False, 2)
EndIf

Exit

Func Get_Systray_Index($sToolTipTitle)

    ; Find systray handle
    $hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:1]')
    If @error Then
        MsgBox(16, "Error", "System tray not found")
        Exit
    EndIf

    ; Get systray item count
    Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
    If $iSystray_ButCount = 0 Then
        MsgBox(16, "Error", "No items found in system tray")
        Exit
    EndIf

    ; Look for wanted tooltip
    For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
        If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop
    Next

    If $iSystray_ButtonNumber = $iSystray_ButCount Then
        Return 0 ; Not found
    Else
        Return $iSystray_ButtonNumber ; Found
    EndIf

EndFunc

WinWait("AppTool", "")
If Not WinActive("AppTool", "") Then WinActivate("AppTool", "")
WinWaitActive("AppTool", "")

ControlFocus("[CLASS:ThunderRT6FormDC]", "", "[CLASS:DTPicker20WndClass;INSTANCE:1]")
   If @error Then
        MsgBox(16, 'Error', 'AppTool focus not found')
        Exit
    EndIf

The code above also uses a UDF so I have attached that also..

Thanks for your help...

SysTray_UDF.au3

Edited by syno

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