Exit Posted September 14, 2012 Posted September 14, 2012 (edited) It is easy to find a submenu item. But how to select/click it? Here a reproducer: #include _Main() Func _Main() Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") $hWnd = WinGetHandle("[CLASS:Notepad]") $hMain = _GUICtrlMenu_GetMenu($hWnd) $t1 = _GUICtrlMenu_GetItemText($hMain, 0) $hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0) $t2 = _GUICtrlMenu_GetItemText($hFile, 3) Writeln( @LF &"Question: " & @LF& @LF & "How to select submenu entry(""" & $t2 & """) of menu(""" & $t1 & """) ? "& @LF& @LF) ; here should be the code to select the submenu. EndFunc ;==>_Main ; Write a line of text to Notepad Func Writeln($sText) ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR) EndFunc ;==>Writeln I'm sure it is simple, but ..... I give up. Please give me a hint.. Thanks in advance. Edited September 14, 2012 by Exit Rach 1 App: Au3toCmd UDF: _SingleScript()
bogQ Posted September 14, 2012 Posted September 14, 2012 Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") WinMenuSelectItem("[CLASS:Notepad]", "", "&File", "Save &As...") TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.
Exit Posted September 14, 2012 Author Posted September 14, 2012 @bogQ Thanks for the hint. Your solution works only in english language. My final solution works for any language. #include _Main() Func _Main() Run("notepad.exe") WinWaitActive("[CLASS:Notepad]") $hWnd = WinGetHandle("[CLASS:Notepad]") $hMain = _GUICtrlMenu_GetMenu($hWnd) $t1 = _GUICtrlMenu_GetItemText($hMain, 0) $hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 0) $t2 = _GUICtrlMenu_GetItemText($hFile, 3) Writeln(@LF & "Question: " & @LF & @LF & "How to select submenu entry(""" & $t2 & """) of menu(""" & $t1 & """) ? " & @LF & @LF) ; here is the solution. It is language independent. WinMenuSelectItem($hWnd, "", $t1, $t2) EndFunc ;==>_Main ; Write a line of text to Notepad Func Writeln($sText) ControlSend("[CLASS:Notepad]", "", "Edit1", $sText & @CR) EndFunc ;==>Writeln App: Au3toCmd UDF: _SingleScript()
Exit Posted December 26, 2012 Author Posted December 26, 2012 You've forgotten #include <GuiMenu.au3>Not forgotten, but the forum software truncates the #include statement. App: Au3toCmd UDF: _SingleScript()
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now