Jump to content

AUTOIT


LOULOU
 Share

Recommended Posts

WinMenuSelectItem()

Boy, I WISH it were that easy! ;) The IE menus are not menus at all. They are Toolbars and WinMenuSelectItem can not handle them. Here is a short snippet that opens IE and clicks on the File|New|Window menus:

#include <A3LMenu.au3>
#include <A3LToolbar.au3>

Global $hToolbar
Global $sTitle ="Google - Microsoft Internet Explorer"

Run("c:\program files\internet explorer\iexplore.exe www.google.com")
_WinWaitActive($sTitle)
GetToolbar()
_Toolbar_ClickAccel($hToolbar, "f"); <-- Click the "File" menu
_Menu_ClickPopupAccel("n")       ; <-- Click the "New" menu on the resulting popup
_Menu_ClickPopupAccel("w")       ; <-- Click the "Window" menu on the second resulting popup

; =================================================================================================
; Get the toolbar handle
; =================================================================================================
Func GetToolbar()
  Local $iI, $iN

  _EnumWindowsInit()
  _EnumWindowsChild(WinGetHandle($sTitle))
  for $iI = 1 to $gaWinList[0][0]
    if $gaWinList[$iI][1] = "ToolbarWindow32" then
      $iN = _Toolbar_MapAccelerator($gaWinList[$iI][0], "f")
      if $iN <> 0 then
        if _Toolbar_GetButtonText($gaWinList[$iI][0], $iN) = "&File" then
          $hToolbar = $gaWinList[$iI][0]
          Return
        endif
      endif
    endif
  next
  _ShowError("GetToolbar: Unable to locate Toolbar handle")
EndFunc

Regards,

Paul

Edited by PaulIA
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Thanks paul I begin working with your library and it is very hard for me even if i know autolit.

In fact my problem is going on Display / Toolbars / Adress Bar and verifying if these one is checked or not and if it is not checked checked it

Here is my problem

I hope my english is not too bad.

Link to comment
Share on other sites

Same song, different verse:

#include <A3LMenu.au3>
#include <A3LToolbar.au3>

Opt("MustDeclareVars", 1)

Global $hToolbar, $hItem
Global $sTitle ="Google - Microsoft Internet Explorer"

Run("c:\program files\internet explorer\iexplore.exe www.google.com")
_WinWaitActive($sTitle)
GetToolbar()
_Toolbar_ClickAccel($hToolbar, "v") ; <-- Click the "View" menu
_Menu_ClickPopupAccel("t")          ; <-- Click then "Toolbars" menu on the resulting popup
if _Menu_IsChecked(_PopupGetHwnd(), 1) then
  _ShowMsg(_Menu_GetMenuString(_PopupGetHwnd(), 1) & " is checked")
else
  _ShowMsg(_Menu_GetMenuString(_PopupGetHwnd(), 1) & " is not checked")
endif

; =================================================================================================
; Get the toolbar handle
; =================================================================================================
Func GetToolbar()
  Local $iI, $iN

  _EnumWindowsInit()
  _EnumWindowsChild(WinGetHandle($sTitle))
  for $iI = 1 to $gaWinList[0][0]
    if $gaWinList[$iI][1] = "ToolbarWindow32" then
      $iN = _Toolbar_MapAccelerator($gaWinList[$iI][0], "f")
      if $iN <> 0 then
        if _Toolbar_GetButtonText($gaWinList[$iI][0], $iN) = "&File" then
          $hToolbar = $gaWinList[$iI][0]
          Return
        endif
      endif
    endif
  next
  _ShowError("GetToolbar: Unable to locate Toolbar handle")
EndFunc
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

Is it possible to change the status of a button without having toi display it ?

For example uncheck Toolbars witout displaying the menu .

Thanks

P.S I detect a problem when the mouse cursor is on then same region as the menu, it causes an error

Edited by LOULOU
Link to comment
Share on other sites

Is it possible to change the status of a button without having toi display it ?

For example uncheck Toolbars witout displaying the menu .

It's not possible to uncheck a popup menu without the menu being displayed. The popup is not created until it is shown the first time.

P.S I detect a problem when the mouse cursor is on then same region as the menu, it causes an error

Please PM or email me a script that shows how to reproduce the error so that I can fix it.
Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
Share on other sites

It's not possible to uncheck a popup menu without the menu being displayed. The popup is not created until it is shown the first time.

Please PM or email me a script that shows how to reproduce the error so that I can fix it.

It is impossible to send you a script. But try in your english version you execute the script you give me and you place the mouse near the display button so you will see that the script desn't give a right result

It's difficult for me to explain it in english

Link to comment
Share on other sites

It is impossible to send you a script. But try in your english version you execute the script you give me and you place the mouse near the display button so you will see that the script desn't give a right result

It's difficult for me to explain it in english

It's not impossible to send me a script. I get them half a dozen times a day. You can PM me or send me an email by clicking on my profile.

The only way I can get the script to fail is by moving the mouse around while the script is trying to click the button. I assume you've got more gray matter than that?

Auto3Lib: A library of over 1200 functions for AutoIt
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...