Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Welcome to Help

Help
2006-01-12
2013-05-28
  • Welcome to Help

     
    • Jeff Winkler
      Jeff Winkler
      2006-02-24

      I'm trying to control an app called MediaMan (http://www.imediaman.com)

      Just simple connect and select a menu:
      from pywinauto import application
      app = application.Application()
      app.connect_ ( title = "jeffMovies - MediaMan" )
      app.top_window_().print_control_identifiers()
      app.top_window_().MenuSelect ("File->Export->Collection")

      This fails with:
      ReBarWindow32 -    (L4, T32, R594, B91) '' 'ReBar'
      MediaMan ToolBarCtrlEx -    (L16, T59, R590, B89) '' 'MediaMan ToolBarCtrlEx'
      WTL_CommandBar -    (L16, T34, R590, B53) '' 'WTL_CommandBar'
      msctls_statusbar32 - Ready   (L4, T417, R594, B440) 'StatusBar' 'Ready' 'ReadyStatusBar'
      ... <snip> ....
      Traceback (most recent call last):
        File "C:\WindowWatcher\pywinAuto_installer\genMovieManCSV.py", line 9, in ?
          app.top_window_().MenuSelect ("File->Export->Collection")
        File "c:\python24\Lib\site-packages\pywinauto\controls\HwndWrapper.py", line 840, in MenuSelect
          path_items = menu.GetMenuPath(path)
        File "c:\python24\Lib\site-packages\pywinauto\controls\HwndWrapper.py", line 1409, in GetMenuPath
          self.Items())
        File "c:\python24\Lib\site-packages\pywinauto\findbestmatch.py", line 94, in find_best_match
          raise MatchError(items = text_item_map.keys(), tofind = search_text)
      MatchError: Could not find 'File' in '[]'

      The menu bar is a draggable palette.. based on the Y coordinates I'd say that the menus are probably in the WTL_CommandBar, contained in the ReBarWindow32.

      How do I select from this kind of menubar?

      Thanks,
      Jeff

       
    • Mark Mc Mahon
      Mark Mc Mahon
      2006-02-24

      Hi Jeff,

      This is exactly the same problem as there is with Internet Explorer menus (and maybe they are common enough that I need to think about making support for them easier).

      For now the best way of using these menus is through the use of TypeKeys()

      E.g. (if the shortcuts for Export and Collection are E and C)
      # Press the alt key and then
      #  F for File
      #  E for Export
      #  C for Collection
      app.top_window_().TypeKeys("%FEC")

      If they have no short cuts and the above doesn't work then you might have to press the down key. (note I am just making up the numbers below - I don't know at what position the items are) e.g.
      # open the file menu
      app.top_window_().TypeKeys("%F")

      # hilight the export item
      # and open it's sub menu
      app.top_window_().TypeKeys("{DOWN 8}")
      app.top_window_().TypeKeys("{RIGHT}")

      # select the collection item
      app.top_window_().TypeKeys("{DOWN 2}{ENTER}")

      I hope that helps - even if it is not the nicest way in the world :-(

      Thanks
         Mark

       
    • Jeff Winkler
      Jeff Winkler
      2006-02-24

      Thanks Mark... TypeKeys("%FEC") worked fine.

        I guess that's not *so bad*, because the keys are directed to that particular app.
      Jeff