| 1 | package Win32::AutoItX::Control; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =head1 NAME | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | Win32::AutoItX::Control - OO interface for Window Controls | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | use Win32::AutoItX; | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | my $a = Win32::AutoItX->new; | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | my $pid = $a->Run('calc.exe'); | ||||||||||||||||||||||||||||
| 14 | my $window = $a->get_window('Calculator'); | ||||||||||||||||||||||||||||
| 15 | $window->wait; | ||||||||||||||||||||||||||||
| 16 | for my $control ($window->find_controls) { | ||||||||||||||||||||||||||||
| 17 | local $\ = "\n"; | ||||||||||||||||||||||||||||
| 18 | print "Control $control"; | ||||||||||||||||||||||||||||
| 19 | print "\thandle: ", $control->handle; | ||||||||||||||||||||||||||||
| 20 | print "\ttext: ", $control->text; | ||||||||||||||||||||||||||||
| 21 | print "\tx: ", $control->x, "\ty: ", $control->y; | ||||||||||||||||||||||||||||
| 22 | print "\twidth: ", $control->width, "\theight: ", $control->height; | ||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | my $button_2 = $window->find_controls('2', class => 'Button'); | ||||||||||||||||||||||||||||
| 26 | my $button_3 = $window->find_controls('3', class => 'Button'); | ||||||||||||||||||||||||||||
| 27 | my $button_plus = $window->find_controls('+', class => 'Button'); | ||||||||||||||||||||||||||||
| 28 | my $button_eq = $window->find_controls('=', class => 'Button'); | ||||||||||||||||||||||||||||
| 29 | my $result = $window->find_controls('0', class => 'Static'); | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | $button_2->click; | ||||||||||||||||||||||||||||
| 32 | $button_3->click; | ||||||||||||||||||||||||||||
| 33 | $button_plus->click; | ||||||||||||||||||||||||||||
| 34 | $button_3->click; | ||||||||||||||||||||||||||||
| 35 | $button_2->click; | ||||||||||||||||||||||||||||
| 36 | $button_eq->click; | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | print "23 + 32 = ", $result->text, "\n"; | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | Win32::AutoItX::Control provides an object-oriented interface for AutoItX | ||||||||||||||||||||||||||||
| 43 | methods to operate with Window Controls. | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | =cut | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 1 | our $VERSION = '1.00'; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 53 | 1 | ▶ | use Scalar::Util qw{ blessed }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 54 | 1 | ▶ | use Win32::AutoItX::Control::ListView; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 55 | 1 | ▶ | use Win32::AutoItX::Control::TreeView; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | use overload fallback => 1, '""' => sub { $_[0]->{control} }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 1 | my %Helper_Methods = qw{ | |||||||||||||||||||||||||||
| 60 | click ControlClick | ||||||||||||||||||||||||||||
| 61 | diable ControlDisable | ||||||||||||||||||||||||||||
| 62 | enable ControlEnable | ||||||||||||||||||||||||||||
| 63 | focus ControlFocus | ||||||||||||||||||||||||||||
| 64 | handle ControlGetHandle | ||||||||||||||||||||||||||||
| 65 | x ControlGetPosX | ||||||||||||||||||||||||||||
| 66 | y ControlGetPosY | ||||||||||||||||||||||||||||
| 67 | width ControlGetPosWidth | ||||||||||||||||||||||||||||
| 68 | height ControlGetPosHeight | ||||||||||||||||||||||||||||
| 69 | text ControlGetText | ||||||||||||||||||||||||||||
| 70 | set_text ControlSetText | ||||||||||||||||||||||||||||
| 71 | hide ControlHide | ||||||||||||||||||||||||||||
| 72 | show ControlShow | ||||||||||||||||||||||||||||
| 73 | move ControlMove | ||||||||||||||||||||||||||||
| 74 | send ControlSend | ||||||||||||||||||||||||||||
| 75 | command ControlCommand | ||||||||||||||||||||||||||||
| 76 | clw ControlListView | ||||||||||||||||||||||||||||
| 77 | ctw ControlTreeView | ||||||||||||||||||||||||||||
| 78 | }; | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 1 | my %Control_Commands = qw{ | |||||||||||||||||||||||||||
| 81 | is_visible IsVisible | ||||||||||||||||||||||||||||
| 82 | is_enabled IsEnabled | ||||||||||||||||||||||||||||
| 83 | show_dropdown ShowDropDown | ||||||||||||||||||||||||||||
| 84 | hide_dropdown HideDropDown | ||||||||||||||||||||||||||||
| 85 | add_string AddString | ||||||||||||||||||||||||||||
| 86 | del_string DelString | ||||||||||||||||||||||||||||
| 87 | find_string FindString | ||||||||||||||||||||||||||||
| 88 | set_selection SetCurrentSelection | ||||||||||||||||||||||||||||
| 89 | select_string SelectString | ||||||||||||||||||||||||||||
| 90 | is_checked IsChecked | ||||||||||||||||||||||||||||
| 91 | check Check | ||||||||||||||||||||||||||||
| 92 | uncheck UnCheck | ||||||||||||||||||||||||||||
| 93 | line_number GetCurrentLine | ||||||||||||||||||||||||||||
| 94 | column GetCurrentCol | ||||||||||||||||||||||||||||
| 95 | selection GetCurrentSelection | ||||||||||||||||||||||||||||
| 96 | line_count GetLineCount | ||||||||||||||||||||||||||||
| 97 | line GetLine | ||||||||||||||||||||||||||||
| 98 | selected GetSelected | ||||||||||||||||||||||||||||
| 99 | paste EditPaste | ||||||||||||||||||||||||||||
| 100 | tab CurrentTab | ||||||||||||||||||||||||||||
| 101 | tab_right TabRight | ||||||||||||||||||||||||||||
| 102 | tab_left TabLeft | ||||||||||||||||||||||||||||
| 103 | }; | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | =head1 METHODS | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | =head2 new | ||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | $control = Win32::AutoItX::Control->new( | ||||||||||||||||||||||||||||
| 110 | $autoitx, $window_title, $window_text, $control_id | ||||||||||||||||||||||||||||
| 111 | ) | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | creates the control object. | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | =cut | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 118 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 119 | 0 | my %self; | |||||||||||||||||||||||||||
| 120 | 0 | $self{autoitx} = shift; | |||||||||||||||||||||||||||
| 121 | 0 | $self{title} = shift; | |||||||||||||||||||||||||||
| 122 | 0 | $self{text} = shift; | |||||||||||||||||||||||||||
| 123 | 0 | $self{control} = shift; | |||||||||||||||||||||||||||
| 124 | 0 | ▶ | $self{text} = '' unless defined $self{text}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 125 | croak "The first argument should be a Win32::AutoItX object" | ||||||||||||||||||||||||||||
| 126 | 0 | ▶ | unless blessed $self{autoitx} and $self{autoitx}->isa('Win32::AutoItX'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
builtin::blessed($self{"autoitx"}) and $self{"autoitx"}->isa("Win32::AutoItX")
MC/DC0%0/2
builtin::blessed($self{"autoitx"}) and $self{"autoitx"}->isa("Win32::AutoItX")
builtin::blessed($self{"autoitx"})
$self{"autoitx"}->isa("Win32::AutoItX")
Truth table0%0/3
A and B
A= builtin::blessed($self{"autoitx"})B= $self{"autoitx"}->isa("Win32::AutoItX")
| |||||||||||||||||||||||||||||
| 127 | 0 | return bless \%self, $class; | |||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | =head2 listview | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | $listview = $control->listview() | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | returns a L<Win32::AutoItX::Control::ListView> object for the control. | ||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | =cut | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub listview { Win32::AutoItX::Control::ListView->new($_[0]) } | ||||||||||||||||||||||||||
|
Subroutine
listview: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 140 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =head2 treeview | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | $treeview = $control->treeview() | ||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | returns a L<Win32::AutoItX::Control::TreeView> object for the control. | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | =cut | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub treeview { Win32::AutoItX::Control::TreeView->new($_[0]) } | ||||||||||||||||||||||||||
|
Subroutine
treeview: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 151 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | =head2 click | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | $control->click() | ||||||||||||||||||||||||||||
| 156 | $control->click($button, $clicks, $x, $y) | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | sends a mouse click command to a given control. C<$button> is the button to | ||||||||||||||||||||||||||||
| 159 | click: "left" (by default), "right" or "middle". C<$clicks> is the number of | ||||||||||||||||||||||||||||
| 160 | times to click the mouse (default is 1). C<$x> and C<$y> is the position to | ||||||||||||||||||||||||||||
| 161 | click within the control (default is center). | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | B<Note>: Some controls will resist clicking unless they are the active window. | ||||||||||||||||||||||||||||
| 164 | Use the C<$window-E<gt>active()> to force the control's window to the top before | ||||||||||||||||||||||||||||
| 165 | using C<click()>). | ||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | Using 2 for the number of clicks will send a double-click message to the control | ||||||||||||||||||||||||||||
| 168 | - this can even be used to launch programs from an explorer control! | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | =head2 disable | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | $control->disable() | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | disables or "grays-out" the control. | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =head2 enable | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | $control->enable() | ||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||
| 180 | enables a "grayed-out" control. | ||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | =head2 focus | ||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||
| 184 | $control->focus() | ||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | sets input focus to a given control on a window. | ||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | =head2 handle | ||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||
| 190 | $handle = $control->handle() | ||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||
| 192 | retrieves the internal handle of the control. | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | =head2 x | ||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||
| 196 | $x = $control->x() | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | retrieves the X coordinate of the control relative to it's window. | ||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | =head2 y | ||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | $y = $control->y() | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | retrieves the Y coordinate of the control relative to it's window. | ||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | =head2 width | ||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||
| 208 | $width = $control->width() | ||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||
| 210 | retrieves the width of the control. | ||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||
| 212 | =head2 height | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | $height = $control->height() | ||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | retrieves the height of the control. | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | =head2 text | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | $text = $control->text() | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | retrieves text from the control. | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | =head2 set_text | ||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||
| 226 | $control->set_text($text) | ||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||
| 228 | sets text of the control. | ||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | =head2 hide | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | $text = $control->hide() | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | hides the control. | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | =head2 show | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | $control->show() | ||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||
| 240 | shows a control that was hidden. | ||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | =head2 move | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | $control->move($x, $y) | ||||||||||||||||||||||||||||
| 245 | $control->move($x, $y, $width) | ||||||||||||||||||||||||||||
| 246 | $control->move($x, $y, $width, $height) | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | moves a control within a window. | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | =head2 send | ||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||
| 252 | $control->send($string) | ||||||||||||||||||||||||||||
| 253 | $control->send($string, $flag) | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | sends a string of characters to the control. If C<$flag> is true send a raw | ||||||||||||||||||||||||||||
| 256 | C<$string> otherwise special characters like C<+> or C<{LEFT}> mean SHIFT and | ||||||||||||||||||||||||||||
| 257 | left arrow. | ||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||
| 259 | =head2 command | ||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||
| 261 | $result = $control->command($command, $option) | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | sends a command to the control. | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | =head2 is_visible | ||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||
| 267 | $boolean = $control->is_visible() | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | returns true if the control is visible. | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | =head2 is_enabled | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | $boolean = $control->is_enabled() | ||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | returns true if the control is enabled. | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | =head2 show_dropdown | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | $control->show_dropdown() | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | drops a ComboBox. | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | =head2 hide_dropdown | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | $control->hide_dropdown() | ||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||
| 287 | undrops a ComboBox. | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | =head2 add_string | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | $control->add_string($string) | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | adds a string to the end in a ListBox or ComboBox. | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | =head2 del_string | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | $control->del_string($occurrence) | ||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||
| 299 | deletes a string according to occurrence in a ListBox or ComboBox. | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | =head2 find_string | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | $control->find_string($string) | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | returns occurrence ref of the exact string in a ListBox or ComboBox. | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | =head2 set_selection | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | $control->set_selection($occurrence) | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | sets selection to occurrence ref in a ListBox or ComboBox. | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | =head2 select_string | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | $control->select_string($string) | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | sets selection according to string in a ListBox or ComboBox. | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | =head2 is_checked | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | $boolean = $control->is_checked() | ||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||
| 323 | returns true if a Button is checked. | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | =head2 check | ||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||
| 327 | $control->check() | ||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||
| 329 | checks a radio or check Button. | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | =head2 uncheck | ||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||
| 333 | $control->uncheck() | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | unchecks a radio or check Button. | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | =head2 line_number | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | $current_line_number = $control->line_number() | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | returns the line # where the caret is in an Edit. | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | =head2 column | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | $current_column = $control->column() | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | returns the column # where the caret is in an Edit. | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | =head2 selection | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | $current_selection = $control->selection() | ||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||
| 353 | returns name of the currently selected item in a ListBox or ComboBox. | ||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||
| 355 | =head2 line_count | ||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||
| 357 | $line_count = $control->line_count() | ||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||
| 359 | returns # of lines in an Edit. | ||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||
| 361 | =head2 line | ||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||
| 363 | $text = $control->line($line_number) | ||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | returns text at line # passed of an Edit. | ||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||
| 367 | =head2 selected | ||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||
| 369 | $text = $control->selected() | ||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||
| 371 | returns selected text of an Edit. | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | =head2 paste | ||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||
| 375 | $control->paste($string) | ||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | pastes the 'string' at the Edit's caret position. | ||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||
| 379 | =head2 tab | ||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||
| 381 | $current_tab = $control->tab() | ||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||
| 383 | returns the current Tab shown of a SysTabControl32. | ||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||
| 385 | =head2 tab_right | ||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||
| 387 | $control->tab_right() | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | moves to the next tab to the right of a SysTabControl32. | ||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||
| 391 | =head2 tab_left | ||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||
| 393 | $control->tab_left() | ||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | moves to the next tab to the left of a SysTabControl32. | ||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | =head2 AutoItX native methods | ||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||
| 399 | This module also autoloads all AutoItX methods. For example: | ||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||
| 401 | $control->WinActivate($win_title) unless $control->WinActive($win_title); | ||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||
| 403 | Please see AutoItX Help file for documenation of all available methods. | ||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||
| 405 | =cut | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | 0 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 408 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 409 | 0 | my $method = our $AUTOLOAD; | |||||||||||||||||||||||||||
| 410 | 0 | $method =~ s/.*:://; | |||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||
| 412 | 0 | my @params = @_; | |||||||||||||||||||||||||||
| 413 | 0 | ▶ | if (exists $Helper_Methods{$method}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 414 | 0 | $method = $Helper_Methods{$method}; | |||||||||||||||||||||||||||
| 415 | 0 | unshift @params, $self->{title}, $self->{text}, $self->{control}; | |||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||
| 417 | 0 | ▶ | if (exists $Control_Commands{$method}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 418 | 0 | ▶ | push @params, '' unless @params; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 419 | unshift @params, $self->{title}, $self->{text}, $self->{control}, | ||||||||||||||||||||||||||||
| 420 | 0 | $Control_Commands{$method}; | |||||||||||||||||||||||||||
| 421 | 0 | $method = 'ControlCommand'; | |||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||
| 423 | print "Call AutoItX method $method with params: @params\n" | ||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if $self->{autoitx}->debug; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 425 | 0 | $self->{autoitx}->{autoit}->$method(@params); | |||||||||||||||||||||||||||
| 426 | } | ||||||||||||||||||||||||||||
| 427 | #------------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||
| 429 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||
| 431 | =over | ||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | =item L<Win32::AutoItX::Control::ListView> | ||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||
| 435 | =item L<Win32::AutoItX::Control::TreeView> | ||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||
| 437 | =item L<Win32::AutoItX::Window> | ||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | =item L<Win32::AutoItX> | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | =item AutoItX Help | ||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||
| 443 | =back | ||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||
| 445 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | Mikhail Telnov E<lt>Mikhail.Telnov@gmail.comE<gt> | ||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||
| 449 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||
| 451 | This software is copyright (c) 2017 by Mikhail Telnov. | ||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||
| 453 | This library is free software; you may redistribute and/or modify it | ||||||||||||||||||||||||||||
| 454 | under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||
| 456 | =cut | ||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | 1 | 1; | |||||||||||||||||||||||||||