Jump to content

Recommended Posts

Posted

I am trying to click a button from a menu. The code below clicks the center button of the menu (the rotate 45 degrees button). I would like to click on the "PDF" button four buttons to the right. 

 ControlClick("", "", "[CLASS:ToolBarWindow32; INSTANCE:1; ID:59392]")  

 

Thank you in advance

ControlClick.PNG

Posted (edited)

Try using :

_GUICtrlToolbar_ButtonCount

See if you have access to individual button, if so then use the UDF to loop thru the toolbar until you find the PDF button. 

Edit : just so you understand, controlClicking a toolbar control will simply click in the center of it...

Edited by Nine
  • Moderators
Posted (edited)

Moved to the appropriate forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Posted (edited)

Use Au3Info.exe - ToolBar page where is shown: Index/CommandID/Text

Use these information by ControlCommand(..., "SendCommandID", ...)

Quote
Simulates the WM_COMMAND message. Usually used for ToolbarWindow32 controls - use the ToolBar tab of Au3Info to get the Command ID.

https://www.autoitscript.com/autoit3/docs/functions/ControlCommand.htm

 

Edited by Zedna
Posted

Zedna

Do you have an example? I am still not getting the syntax to select a specific button via ControlCommand

Thank you in advance

Posted (edited)
; Title/Text (of target app) params should be given accordingly
; 1234 -> Command ID from Au3Info/ToolBar
ControlCommand("", "", "ToolBarWindow321", "SendCommandID", 1234)

 

or this  - your way of identifying of ToolBar control:

ControlCommand("", "", "[CLASS:ToolBarWindow32; INSTANCE:1; ID:59392]", "SendCommandID", 1234)

 

Edited by Zedna
Posted

Zedna - thank you for the feedback

I tried code below, did not work, attaching screen shot of Summary Tab, I am looking to click on the PDF button

ControlCommand("", "", "ToolBarWindow321", "SendCommandID", 32777)

SummaryTab.PNG

Posted

Zedna

I tried the following, with and without quotes no luck

        ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32773)
        ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 57603)
        ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 0)
        ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32777)
        ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32771)
        ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32776)
        ControlCommand("PATHOLOGY REPORTS", "", "ToolBarWindow321", "SendCommandID", 32774)

Posted (edited)

Mind running it :

#include <Constants.au3>
#include <GuiToolbar.au3>

Local $hWnd = WinGetHandle("PATHOLOGY REPORTS")
Local $hCtrl = ControlGetHandle($hWnd, "", "ToolbarWindow321")
ConsoleWrite ($hWnd & "/" & $hCtrl & @CRLF)
ConsoleWrite (_GUICtrlToolbar_ButtonCount ($hCtrl) & @CRLF)

For $i = 0 to _GUICtrlToolbar_ButtonCount ($hCtrl)-1
  $b = _GUICtrlToolbar_IndexToCommand($hCtrl,$i)
  $t = _GUICtrlToolbar_GetButtonText($hCtrl,$b)
  ConsoleWrite ($i & "/" & $b & "/" & $t & @CRLF)
Next

So we know more about this toolbar.  Post console result.

Edited by Nine
Posted

Results posted below, also the document is a .csd file

 

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\ProductionVER2\zzzButtonTester.au3"    
0x005304E8/0x00590164
16
0/32773/
1/57603/
2/0/
3/32771/
4/32772/
5/32776/
6/32775/
7/0/
8/32774/
9/32777/
10/32778/
11/32780/
12/0/
13/32789/
14/57607/
15/57664/
>Exit code: 0    Time: 0.2402

Posted

I pasted after the Next

>"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\ProductionVER2\zzzButtonTester.au3"    
0x005304E8/0x00590164
16
0/32773/
1/57603/
2/0/
3/32771/
4/32772/
5/32776/
6/32775/
7/0/
8/32774/
9/32777/
10/32778/
11/32780/
12/0/
13/32789/
14/57607/
15/57664/
0
>Exit code: 0    Time: 0.2491

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