Examples
rdp edited this page Aug 18, 2011
·
7 revisions
>> window = RAutomation::Window.new(:hwnd => 0x00000000000206AA) >> window.exist? # you must verify this first, otherwise if it doesn't exist, all other future calls will wait 60 seconds before finally giving up => true >> window.text => "Issues - jarmo"
Other ways to search:
- id
- parent_id # doesn't seem to work
- title
- value # value of what?
- class # window class
- hwnd
- pid
example:
window = RAutomation::Window.new(:class => "Chrome_WidgetWin_0") # example of using an arbitrary window class name
h3. Enumerate windows if there's more than one that matches.
RAutomation::Window.new(:title => /jarmo/).windows.map{|w| w} # an array with the several.
h3. Enumerate all top level "desktop" windows:
>> RAutomation::Window.new(:title => //i).windows >> RAutomation::Window.new(:title => //i).windows.map{|w| w} # it lazy loads by default, so we'll use map to show the real windows >> RAutomation::Window.new(:title => //i).windows.map{|w| w.title} # show top level window titles