Jump to content

trying to select/click on the file menu of a window.


Go to solution Solved by serena_knight,

Recommended Posts

the following code was adopted form various topics vis the search to try to click on file then get click on an item under file

$winh = winactivate("Power")

$menuh = _guictrlmenu_getmenu($winh)

$titletxt = _guictrlmenu_getitemtext($menuh,0)   ; get File

; returns &File

$rc = winmenuselectitem($winh, "", $titletxt)

;  returns 0

; tied

$rc = winmenuselectitem(menuh,"", $titletxt)

; also returns 0

i need to click on File to get the dropdown

can you help?

 

 

Link to post
Share on other sites
Link to post
Share on other sites

As per help file :

Quote

WinMenuSelectItem() will only work on standard menus. Unfortunately, many menus in use today are actually custom written or toolbars "pretending" to be menus. This is true for most Microsoft applications.

Try to make it worked with Notepad first.  We will be able to assist you since we do not have your application.

And use this tool, when you post code

Link to post
Share on other sites

Try this :

#include <GuiMenu.au3>
#include <Array.au3>

Run ("notepad.exe")
$winh = WinWait("[CLASS:Notepad]")
ConsoleWrite($winh & @CRLF)

$menuh = _guictrlmenu_getmenu($winh)

$titletxt = _guictrlmenu_getitemtext($menuh,0)   ; get File

ConsoleWrite($titletxt & @CRLF)

$aRect = _GUICtrlMenu_GetItemRect($winh, $menuh, 0)
;_ArrayDisplay($aRect)

MouseClick("left", $aRect[0]+10, $aRect[1]+5, 1, 1)

 

Link to post
Share on other sites
Link to post
Share on other sites
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...