Jump to content

DropDownMenu


KillaB
 Share

Recommended Posts

Hello, 

thanks for your quick answer.

Here's the partial script i wrote. If i would manage to select the option from the drop down menu, the rest of the script runs smooth (it fills the date now, but in different location because "Z reports" is selected), It also clicks the Set connection button as well.

 

Link to comment
Share on other sites

; Start anaf_Download.exe
Run("C:\Users\s009pos10\Desktop\anaf_Download.exe")
; Wait until the window with ANAF files - downloader title becomes active
Local $hWnd = WinWaitActive("ANAF files - downloader","")
; Expand Range type, Search for Date and time and Select it
ControlCommand($hWnd, "", "TNewComboBox1", "SelectString", "Date and time")
; Write From and to
Send("01.03.2020")
Send("{TAB}")
Send("31.03.2020")
Sleep(2000)

; Define members
Local $clicked = 0
Local $buttonName = "Set connection"
Local $timeout = 10

; Wait recursively 5 seconds for active button
For $i = 1 To $timeout Step 1
      ; Check if the Set connection button is active
      If ControlCommand($hWnd, "", $buttonName, "IsEnabled", "") <> 0 Then
         ; Click the button and end the loop
         $clicked = ControlClick($hWnd, "", "[TEXT:" & $buttonName & "]")
         If $clicked = 1 Then
            ExitLoop
         EndIf
      EndIf
      Sleep(1000)
Next

Link to comment
Share on other sites

@KillaB
You could try to use ControlGetHandle() to get the handle of the ComboBox, and then use _GUICtrlComboBox_SetCurSel() to set the selected item in it.
Try those and post the result.
By the way, use the code tag <> to post the code, so it is correctly formatted :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

@KillaB
There you go:

#include <GuiComboBoxEx.au3> ; This include is needed in order to use _GUICtrlComboBox* functions

Global $hWnd, _
       $hdlComboBox

; Start anaf_Download.exe
Run("C:\Users\s009pos10\Desktop\anaf_Download.exe")

; Wait until the window with ANAF files - downloader title becomes active
$hWnd = WinWaitActive("ANAF files - downloader","")

; Getting the Handle of the ComboBox control
$hdlComboBox = ControlGetHandle($hWnd, "", "[CLASSNN:TNewComboBox1]")

If IsHWnd($hdlComboBox) Then
    If _GUICtrlComboBox_SetCurSel($hdlComboBox, 0) <> -1 Then MsgBox(0, "", "Item selected!", 5)
EndIf

Study the sample :)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...