autoit 1.3.3 → 1.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0e206f6def43b78a1828fd2e6802fe2bcb4d4070fa8b0a593ddba9d035786f7
4
- data.tar.gz: c03eedf627d8571339149e13c0a381cc735733adf8991c5be37741ed28719e41
3
+ metadata.gz: 7e68b245e1cccaaa0ff3dd21f876a885ad3bafc89ff34dec5d68573eb37d51ba
4
+ data.tar.gz: 29798556724cd8beee8be1d2ad083922e3798e3d6091349924de400ca3adb989
5
5
  SHA512:
6
- metadata.gz: b8a8a9fbac49831d86f7cb32bea30a94159e3d518bfb648e35966bf12379b036ee62cfc64d56d6a0ced09e44239232e2d62eb7c45a51bab0af089a7a9aee3cdc
7
- data.tar.gz: c9b94c2ee8609e2c13f253addeba9d1ac4566bce74d1ed5c5fd7e467680e89a447a3b09eb627ff93ce5d5c78110ca123fe1df9604492d9525368ab72b0a38c85
6
+ metadata.gz: 3e6c4a80e3012c05e1629606babab300658e139707402413dde737fc9fbd2f34b2de0a0055e6127a3f693159f742dfdbaa2c6cc4e86447f20e77fb103932986d
7
+ data.tar.gz: bc89013d25992444294c53ac3c37b369a1635a28dd71d75c4af2598e481f3b572f94aa2604ec581c8a8209f7237094662c3d0b5908ea187916096aad37d46912
@@ -16,6 +16,10 @@ module AutoIt
16
16
  execute { win.send(cmd, *args) }
17
17
  end
18
18
 
19
+ def command_validate(cmd, args={})
20
+ execute_validate{win.send(cmd. *args)}
21
+ end
22
+
19
23
  def win_close(title)
20
24
  execute { win.WinClose title }
21
25
  end
@@ -74,10 +78,96 @@ module AutoIt
74
78
  execute { win.WinExists(title, text) }
75
79
  end
76
80
 
81
+ # Activates (gives focus to) a window.
82
+ # @param: title: The title/hWnd/class of the window to activate.
83
+ def win_activate(*args)
84
+ if args == 1
85
+ command'WinActivate', [args[0]]
86
+ elsif args == 2
87
+ command'WinActivate', [args[0], args[1]]
88
+ end
89
+ end
90
+
91
+ # Sets input focus to a given control on a window.
92
+ # @param: title: The title of the window to access.
93
+ # @param: text: The text of the window to access.
94
+ # @param: control: The control to interact with.
95
+ def control_focus(title, text, control)
96
+ command 'ControlFocus', [title, text, control]
97
+ end
98
+
99
+ # Sends simulated keystrokes to the active window.
100
+ # keys: The sequence of keys to send.
101
+ def send keys
102
+ command 'Send', [keys, 1]
103
+ end
104
+
105
+ # Sets selection according to string in a ListBox or ComboBox
106
+ # @param: title: The title of the window to access.
107
+ # @param: text: The text of the window to access.
108
+ # @param: control: The control to interact with.
109
+ # @param: string: The string.
110
+ def control_command_select_string(title, text, control, string)
111
+ command 'ControlCommand', [title, text, control, 'SelectString', string]
112
+ end
113
+
114
+ # Drops a ComboBox
115
+ # @param: title: The title of the window to access.
116
+ # @param: text: The text of the window to access.
117
+ # @param: control: The control to interact with.
118
+ def control_command_show_drop_down(title, text, control)
119
+ command 'ControlCommand', [title, text, control, 'ShowDropDown', '']
120
+ end
121
+
122
+ # Undrops a ComboBox
123
+ # @param: title: The title of the window to access.
124
+ # @param: text: The text of the window to access.
125
+ # @param: control: The control to interact with.
126
+ def control_command_hide_drop_down(title, text, control)
127
+ command 'ControlCommand', [title, text, control, 'HideDropDown', '']
128
+ end
129
+
130
+ # Sets text of a control.
131
+ # Sends a string of characters to a control.
132
+ # @param: title: The title of the window to access.
133
+ # @param: text: The text of the window to access.
134
+ # @param: control: The control to interact with.
135
+ # @param: string: The string.
136
+ # @return True if success, false otherwise
137
+ def control_set_text(title, text, control, value)
138
+ command_validate'ControlSetText', [title, text, control, value]
139
+ end
140
+
141
+ # Sends a mouse click command to a given control.
142
+ # @param: title: The title of the window to access.
143
+ # @param: text: The text of the window to access.
144
+ # @param: controlID: The control to interact with.
145
+ # @param: button: The button to click, "left", "right" or "middle".
146
+ # @param: clicks: The number of times to click the mouse. Default is center.
147
+ # @param: x: The x position to click within the control. Default is center.
148
+ # @param: y: The y position to click within the control. Default is center.
149
+ # @return: True if success, false otherwise.
150
+ def control_click(title, text, control, button, clicks, x, y)
151
+ command_validate('ControlClick', [title, text, control, button, clicks, x, y])
152
+ end
153
+
154
+ # Sets selection to occurrence ref in a ListBox or ComboBox.
155
+ # @param: title: The title of the window to access.
156
+ # @param: text: The text of the window to access.
157
+ # @param: control: The control to interact with.
158
+ # @param: occurrance: the value.
159
+ def control_command_set_current_selection(title, text, control, occurrance)
160
+ command('ControlCommand', [title, text, control, 'SetCurrentSelection', occurrance])
161
+ end
162
+
77
163
  private
78
164
 
79
165
  def execute
80
- yield > 0
166
+ yield
167
+ end
168
+
169
+ def execute_validate
170
+ yield > 0
81
171
  end
82
172
  end
83
173
  end
@@ -1,3 +1,3 @@
1
1
  module Autoit
2
- VERSION = '1.3.3'.freeze
2
+ VERSION = '1.3.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autoit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronaldo Possan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-12-18 00:00:00.000000000 Z
12
+ date: 2019-04-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: os