Zachlr Posted August 7, 2009 Posted August 7, 2009 I want to check the state (checked or unchecked) of a (technically, sub)menu item in a GUI that wasn't created by an AutoIt script. Take Notepad for example, how do I check whether "Word-Wrap" is checked or unchecked? I'm not sure if this is possible with AutoIt, but if so, please tell me how to do it. Thanks, Zach
AdmiralAlkex Posted August 7, 2009 Posted August 7, 2009 Try the example for _GUICtrlMenu_GetItemChecked(). It's just 2 numbers you need to change to check the "Word-Wrap" instead of "Open". .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Zachlr Posted August 7, 2009 Author Posted August 7, 2009 Thanks. I should be able to figure something out from there. I don't think to look in the UDF help file.
Alexandra Posted December 4, 2009 Posted December 4, 2009 Try the example for _GUICtrlMenu_GetItemChecked(). It's just 2 numbers you need to change to check the "Word-Wrap" instead of "Open". Hi, I have the same problem, I need to reach state of some menu items, and it seems that _GUICtrlMenu_GetItemChecked() doesn't work correct. When I tried this example with item "Word wrap", it doesn't work, it returns state ""False", though state is checked. Run("Notepad.exe") WinWaitActive("[CLASS:Notepad]") $hWnd = WinGetHandle("[CLASS:Notepad]") $hMain = _GUICtrlMenu_GetMenu($hWnd) $hFile = _GUICtrlMenu_GetItemSubMenu($hMain, 2) $iIndex = _GUICtrlMenu_FindItem ($hFile, "Word wrap") MsgBox(4096, "Information", "Index for Help Menu: " & $iIndex) ; Check menu item Writeln("Word wrap is checked: " & _GUICtrlMenu_GetItemChecked($hFile, $iIndex)) What I do wrong?
AdmiralAlkex Posted December 4, 2009 Posted December 4, 2009 Are you running Windows 7? Because I'm and I have the same problem that you are describing. I don't know why it happens, but it seem to work if the menu is displayed BEFORE you do GetItemChecked(), like this: ControlSend("[CLASS:Notepad]", "", "", "!o") ControlSend("[CLASS:Notepad]", "", "", "{ALT}") ; Check menu item Writeln("Word Wrap is checked: " & _GUICtrlMenu_GetItemChecked($hFile, Number($iIndex))) (not very fancy but you get my point) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Alexandra Posted December 4, 2009 Posted December 4, 2009 (edited) Are you running Windows 7? Because I'm and I have the same problem that you are describing. I don't know why it happens, but it seem to work if the menu is displayed BEFORE you do GetItemChecked(), like this: ControlSend("[CLASS:Notepad]", "", "", "!o") ControlSend("[CLASS:Notepad]", "", "", "{ALT}") ; Check menu item Writeln("Word Wrap is checked: " & _GUICtrlMenu_GetItemChecked($hFile, Number($iIndex))) (not very fancy but you get my point) No, I'm using WinXP sp3. Yes, if item was shown before I get it's status, GetItemChecked() works. It can be current solution for my work... It seems like this function works correct only for those items, that aren't intended for checked, for example File, Open, Paste etc. And for those items, that really can be checked/unchecked it doesn't work! Edited December 4, 2009 by Alexandra
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