Jump to content

Recommended Posts

Hello, 

Please help me with a command to select "Date and time" option from the drop down menu below.

i tried several commands from this forum, but none with success.

image.png.2554a3d0b519d708af04933b03bc2eb5.png

Thanks in advance !

Share this post


Link to post
Share on other sites

Hi @KillaB, and welcome to the AutoIt forums :welcome:
Could you please post the entire script you are using?


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
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

Share this post


Link to post
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

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

I'm sorry, i am confused, it's my first time using commands, can you give me an example, please?Would be so kind of you

Share this post


Link to post
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

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


Link to post
Share on other sites

I tried your solution but it doesn't work. i don't know what else to do...Thank you so much, anyway

 

Share this post


Link to post
Share on other sites

@KillaB

Could you please post the entire code using the <> code tag here above?

By the way, the MsgBox doesn't show up?


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...