OldGuyWalking

Identifying Button in Toolbar When There is no ControID

3 posts in this topic

#1 ·  Posted (edited)

I want to click on a button that is inside a custom ToolBar on a nonAutoIT created form.  I've been using MouseClick but that fails if the toolbar is detached or if the form is resized.

There is no ID associated with the toolbar but there is a handle.  I'm thinking that to get the handle I need a ControlID but that only gets me to the toolbar and I'd then need to have a way to identify the position of a button in order to click on it.  

I'd found a discussion about identifying the position of a noname button by, I believe, it's Tip text back in December but I can't find it now.  Memory is a bit fuzzy on how I even got to the topic because at the time I was searching for something else.   I'll continue to search but if anyone has seen the topic, or knows of another solution could you please point me in that direction. 

Thank you.

Edited by OldGuyWalking

Share this post


Link to post
Share on other sites



If you can get the handle you can still click on the specific button you want

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

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

 

Share this post


Link to post
Share on other sites

InunoTaishou - Thank you for the reply. 

The buttons are part of the toolbar and inherit the handle from the toolbar.   The toolbar I'm looking at has 15 buttons.  Using AU3Info and moving across each of the 15, they each show the same handle as the Toolbar.  None of the buttons, nor the Toolbar, show a Control ID in Au3Info.

So, I can a toolbars handle but I cannot identify a specific button to click inside the toolbar because they all show the same information, with one exception, and that's the Visible Text. 

In this application, nothing shows (as in it's totally blank) in AU3Info under the Toolbar or the Statusbar tabs when selecting any toolbar or statusbar.

Thanks again.

 

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

  • Similar Content

    • Skysnake
      By Skysnake
      Hello
      So I thought it would be cool to use my Gravatar account to display my gravatar in a local GUI.
      I use this code:
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: Skysnake Script Function: Example to download avatar from Gravatar and display locally #ce ---------------------------------------------------------------------------- ; Script Start ; includes #include <Crypt.au3> #include <InetConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> ; declare Global vars Global $md5GraMail = '' ; will store email for Grvatar request request GravatarLogin() GetAvatar() Func GravatarLogin() ; get the email required for downloading the Gravatar Local $sGraMail = InputBox("Get Gravatar", "What is your email registered with Gravatar?", "someone@somewhere.com", "", -1, -1, 0, 0) ; from http://en.gravatar.com/site/implement/hash/ ; make the hash ; Local $dHash = _Crypt_HashData(GUICtrlRead($g_idInputEdit), $g_iAlgorithm) ; Create a hash of the text entered $md5GraMail = _Crypt_HashData(StringLower(StringStripWS($sGraMail, 8)), $CALG_MD5) ; lose the left two '0x' chars and convert to lower case $md5GraMail = StringLower(StringTrimLeft($md5GraMail, 2)) ; Display the result. MsgBox($MB_SYSTEMMODAL, "", $sGraMail & @CRLF & "md5 " & $md5GraMail, 15) EndFunc ;==>GravatarLogin ; example from Help file: /html/functions/InetGet.htm ; Download a file in the background. ; Wait for the download to complete. Func GetAvatar() ; Save the downloaded file to the temporary folder. Local $sFilePath = _WinAPI_GetTempFileName(@TempDir) ; from http://en.gravatar.com/site/implement/images/ ; <img src="https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50" /> ; Download the file in the background with the selected option of 'force a reload from the remote site.' ; the next THREE options are alternatives ; Gravatar sample from here http://en.gravatar.com/site/implement/images/ ; 1 ;Local $hDownload = InetGet("https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; the normal code, should show user avatar ; 2 Local $hDownload = InetGet("https://www.gravatar.com/avatar/" & $md5GraMail & "?d=retro", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; my email hardcoded, downloads, but does not show avatar ; 3 ;Local $hDownload = InetGet("https://www.gravatar.com/avatar/cac637b47c9fecc8aa1dcdf71e7a4cc8", $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND) ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True. Do Sleep(250) Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE) ; Retrieve the number of total bytes received and the filesize. Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD) Local $iFileSize = FileGetSize($sFilePath) ; Close the handle returned by InetGet. InetClose($hDownload) ; Display details about the total number of bytes read and the filesize. MsgBox($MB_SYSTEMMODAL, "", "The total download size: " & $iBytesSize & @CRLF & _ "The total filesize: " & $iFileSize, 1) Local $MyGravatar = @ScriptDir & "\Gravatar.jpg" FileCopy($sFilePath, $MyGravatar) MsgBox(0, "Now showing!", $MyGravatar, 5) ; make gui and show file GUICreate("My Gravatar in a GUI " & $MyGravatar, 350, 300, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; will create a dialog box that when displayed is centered Local $idPic = GUICtrlCreatePic($MyGravatar, 50, 50, 80, 80) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ;FileDelete($MyGravatar) ; Delete the file. FileDelete($sFilePath) EndFunc ;==>GetAvatar Now, here is the issue.
      If I use the example from the Gravatar site, located here:
      http://en.gravatar.com/site/implement/images/
      Then this code  205e460b479e2e5b48aec07710c08d50  downloads this pic   (not me)
      AND it displays correctly.
       
      PROBLEM
      However, If I download my own Gravatar, I see the image in the @Script folder, BUT IT DOES NOT DISPLAY.  The same with the retro image.  To be clear, this image   downloads, but is not displayed.
       
      I guess it has something to do with the format of my gravatar. Or that the display funtion GUICtrlCreatePic() does not like my gravatar.
      I would be grateful if someone would be willing to test this and may offer a suggestion or two... 
      Skysnake
       
    • jannikrendl
      By jannikrendl
      Hey guys,
      I was trying to create a script with a GUI but when I start the script via pressing the startbutton in my GUI and then trying to stop the script it won't close/stop.
      Here is the script:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $GUI = GUICreate("AlphaAgility", 218, 65, 1147, 123) Global $StartButton = GUICtrlCreateButton("Start", 24, 16, 75, 25) Global $StopButton = GUICtrlCreateButton("Stop", 120, 16, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $StartButton while(1) Agility() WEnd Case $StopButton Exit EndSwitch WEnd Global $agility = False Func Agility() MouseClick("Left",random(466,500),random(634,669),1,random(10,20));Balancier-Stamm If Not(@error) Then $agility = True sleep(random(0,200)) MouseMove(random(408,661),random(632,749),random(10,20));random Mousemovement Balancier-Stamm Else EndIf sleep(5500) MouseClick("Left",448,820,1,random(10,20));Netz If Not(@error) Then $agility = True sleep(random(0,200)) MouseMove(random(334,557),random(774,876),random(10,20));random Mousemovement Netz Else $agility = False EndIf sleep(3750) MouseClick("Left",480,706,1,random(10,20));Ast If Not(@error) Then $agility = True ;sleep(random(0,200)) ;MouseMove(random(95,953),random(117,1067),random(10,20)) -> kein random Mousemovement nötig Else $agility = False EndIf sleep(2750) MouseClick("Left",727,608,1,random(10,20));Balancier-Seil If Not(@error) Then $agility = True sleep(random(0,200)) MouseMove(random(723,891),random(572,676),random(10,20));random Mousemovement Balancier-Seil Else $agility = False EndIf sleep(6750) MouseClick("Left",698,633,1,random(10,20));Ast If Not(@error) Then $agility = True ;sleep(random(0,200)) ;MouseMove(random(95,953),random(117,1067),random(10,20)) -> kein random Mousemovement nötig Else $agility = False EndIf sleep(4000) MouseClick("Left",random(372,459),random(136,202),1,random(10,20));Netz If Not(@error) Then $agility = True sleep(random(0,200)) MouseMove(random(388,510),random(140,212),random(10,20));random Mousemovement Netz Else $agility = False EndIf sleep(6250) MouseClick("Left",random(362,401),random(363,409),1,random(10,20));Röhre If Not(@error) Then $agility = True ;sleep(random(0,200)) ;MouseMove(random(95,953),random(117,1067),random(10,20)) -> kein random Mousemovement nötig Else $agility = False EndIf sleep(7000) MouseClick("Left",14,654,1,random(10,20));Startposition If Not(@error) Then $agility = True ;sleep(random(0,200)) ;MouseMove(random(388,510),random(140,212),random(10,20)) -> kein random Mousemovement nötig Else EndIf sleep(4000) EndFunc Thanks in advance
      Jannik Rendl
    • nlta1992
      By nlta1992
      I want creat GUI, have button 1 to 10, but only use loop for ... to ... step ... next.
      Thanks.
    • ur
      By ur
      We are trying to automate the installation testing before sending to end users, our product.
      For Silent Installation, we have completed this part.
      But for GUI, the default installation is completed by sending the keys based on the window.
      But for GUI custom installation, we are struck.
      How to enable or disable features in the below screen using GUI automation.?

    • drapdv
      By drapdv
      I have a GUI with a parent window that has a menu and shortcut buttons at the top, and a child window which displays a list which is scrolled vertically.
      When the list is relatively small, like no more than 100 or so lines then it scrolls fine.  As the list gets larger, scrolling begins to slow, and if you start mixing up the scroll method (mousewheel, left-clicking the scrollbar box, etc) then it begins to hang.  When it hangs, dwm.exe CPU usage maxes out, and I can't even switch to another window.  Each line in the list is 1000px wide X 30px tall, and the lines alternate between a gray background and a white background, in case that matters.
      When a non-Aero theme is active, everything works fine.  So, I could disable DWM every time someone fires it up, but changing a client's color scheme is not ideal.
      I tried to utilize _WinAPI_DwmSetWindowAttribute($oGui_Parent,  $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED), and although it succeeds in disabling DWM for that window, it doesn't seem to make any difference as far as the scrolling lag is concerned.
      The code is several thousand lines long and contains proprietary information, so I'm trying to avoid posting that, but these are the lines which are creating the GUIs.  Is there anything that anyone can think of off the top of their heads, or is there anything jumping out at you from this snippet of code?  Any help is appreciated!
      $oGui_Parent = GUICreate("Data Viewer", 700, 500, Default, Default, BitOR($WS_CAPTION, $WS_MINIMIZEBOX, $WS_POPUPWINDOW)) WinSetTrans($oGui_Parent, "", 255) _WinAPI_DwmSetWindowAttribute($oGui_Parent, $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED) GUISetFont(9, 500, 0, "Calibri") GUISetBkColor(0xFFFFFF) $oGui_Child = GUICreate("", 700, 400, 0, 100, $WS_POPUP, $WS_EX_MDICHILD, $oGui_Parent) WinSetTrans($oGui_Child, "", 255) _WinAPI_DwmSetWindowAttribute($oGui_Child, $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED) GUISetFont(9, 500, 0, "Calibri") GUISetBkColor(0xFFFFFF)