Hi Mark,
how hard would it be to write a function to get the control
identifiers of menus ?
It seems that getting started and finding out what the names of the
things are one can control is really tricky.
How are others going about this?
(Regarding your underscore: I now understand your reason for it, and I
would suggest to use a leading underscore, even if it goes somewhat
against the usual Python use of it, it seems a good way of preventing
(most) names clashes, and still having all methods "next" to one
another (if sorted alphabetically))
- Sebastian
On Fri, Mar 5, 2010 at 12:55 PM, Mark Mc Mahon <mtn...@gm...> wrote:
> Hi Sebastian,
>
> On Fri, Mar 5, 2010 at 7:06 PM, Sebastian Haase <seb...@gm...> wrote:
>> Hi,
>>
>> still trying to get started, I did this:
>>>>> import pywinauto
>>>>> app = pywinauto.application.Application()
>>>>> a = app.start_("notepad")
>>>>> w = a.top_window_()
>>>>> w.print_control_identifiers()
>> Control Identifiers:
>> Edit - '' (L690, T73, R1250, B983)
>> '' '0' '1' 'Edit'
>>>>>
>>
>> Why do I only get info for the "Edit" menu? Notepad has 5 menus
>> (including the "?" one).
>>
> Notepad actually only has 1 child window (when the status bar is not
> switched on). The print control identifiers method only prints child
> controls, though maybe I should add some kind of function to print
> menus too - never though of it before.
>
>
> Running out the door, but see the following script for why it is taking slow...
> import pywinauto
> import time
> from pywinauto.timings import Timings
>
> app = pywinauto.application.Application()
> a = app.start_("notepad")
>
>
> start = time.time()
> w = a.top_window_()
> print "a", time.time() - start
>
> # just to show it is not caching
> start = time.time()
> w2 = a.top_window_()
> print "b", time.time() - start
>
> Timings.window_find_timeout = .1
> start = time.time()
> w3 = a.top_window_()
> print "c", time.time() - start
>
> print w, w2, w3
>
> w.print_control_identifiers()
>
> Timings.window_find_timeout currently defaults to 3 seconds, I need to
> look into why so long.
>
>
>> Also what is the meaning of the trailing underscore in top_window_() ?
>> And, top_window_() takes about 1 second to return, why is this ?
>>
>
> The underscore is to avoid clashes with a window with the title "top
> window". (I should probably remove these underscores)
>
>
>> Cheers,
>> Sebastian
>
> Mark
>
|