au3 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/AutoItX3/au3.rb +3 -5
- data/lib/AutoItX3/control.rb +511 -44
- data/lib/AutoItX3/filedir.rb +68 -21
- data/lib/AutoItX3/graphic.rb +29 -5
- data/lib/AutoItX3/keyboard.rb +18 -4
- data/lib/AutoItX3/misc.rb +85 -28
- data/lib/AutoItX3/mouse.rb +82 -16
- data/lib/AutoItX3/process.rb +116 -51
- data/lib/AutoItX3/window.rb +346 -61
- data/lib/AutoItX3/window/send_message.rb +271 -0
- data/lib/HISTORY.rdoc +10 -0
- data/lib/README.rdoc +26 -1
- data/lib/au3.rb +6 -0
- data/test/test_misc.rb +2 -1
- data/test/test_window_messages.rb +42 -0
- metadata +42 -16
@@ -0,0 +1,271 @@
|
|
1
|
+
#Encoding: UTF-8
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright © 2009, 2010 Marvin Gülker, Steven Heidel
|
4
|
+
#
|
5
|
+
#au3 is published under the same terms as Ruby.
|
6
|
+
#See http://www.ruby-lang.org/en/LICENSE.txt
|
7
|
+
|
8
|
+
#This file is only useful together with the other ones
|
9
|
+
require_relative "../../au3"
|
10
|
+
|
11
|
+
module AutoItX3
|
12
|
+
|
13
|
+
class Window
|
14
|
+
|
15
|
+
Window.functions[:get_last_error] = Win32::API.new("GetLastError", '', 'I', "kernel32")
|
16
|
+
|
17
|
+
#Constant values for use with Window#send_message and
|
18
|
+
#Window#post_message. The constant names and values have
|
19
|
+
#been extracted from wm.h at http://technology.niagarac.on.ca,
|
20
|
+
#which in turn was extracted from the winuser.h which is
|
21
|
+
#Copyright (c) 1985-1996 Microsoft Corporation.
|
22
|
+
module Messages
|
23
|
+
WM_CREATE = 0x0001
|
24
|
+
WM_DESTROY = 0x0002
|
25
|
+
WM_MOVE = 0x0003
|
26
|
+
WM_SIZE = 0x0005
|
27
|
+
WM_ACTIVATE = 0x0006
|
28
|
+
WM_SETFOCUS = 0x0007
|
29
|
+
WM_KILLFOCUS = 0x0008
|
30
|
+
WM_ENABLE = 0x000A
|
31
|
+
WM_SETREDRAW = 0x000B
|
32
|
+
WM_SETTEXT = 0x000C
|
33
|
+
WM_GETTEXT = 0x000D
|
34
|
+
WM_GETTEXTLENGTH = 0x000E
|
35
|
+
WM_PAINT = 0x000F
|
36
|
+
WM_CLOSE = 0x0010
|
37
|
+
WM_QUERYENDSESSION = 0x0011
|
38
|
+
WM_QUIT = 0x0012
|
39
|
+
WM_QUERYOPEN = 0x0013
|
40
|
+
WM_ERASEBKGND = 0x0014
|
41
|
+
WM_SYSCOLORCHANGE = 0x0015
|
42
|
+
WM_ENDSESSION = 0x0016
|
43
|
+
WM_SHOWWINDOW = 0x0018
|
44
|
+
WM_WININICHANGE = 0x001A
|
45
|
+
WM_DEVMODECHANGE = 0x001B
|
46
|
+
WM_ACTIVATEAPP = 0x001C
|
47
|
+
WM_FONTCHANGE = 0x001D
|
48
|
+
WM_TIMECHANGE = 0x001E
|
49
|
+
WM_CANCELMODE = 0x001F
|
50
|
+
WM_SETCURSOR = 0x0020
|
51
|
+
WM_MOUSEACTIVATE = 0x0021
|
52
|
+
WM_CHILDACTIVATE = 0x0022
|
53
|
+
WM_QUEUESYNC = 0x0023
|
54
|
+
WM_GETMINMAXINFO = 0x0024
|
55
|
+
WM_PAINTICON = 0x0026
|
56
|
+
WM_ICONERASEBKGND = 0x0027
|
57
|
+
WM_NEXTDLGCTL = 0x0028
|
58
|
+
WM_SPOOLERSTATUS = 0x002A
|
59
|
+
WM_DRAWITEM = 0x002B
|
60
|
+
WM_MEASUREITEM = 0x002C
|
61
|
+
WM_DELETEITEM = 0x002D
|
62
|
+
WM_VKEYTOITEM = 0x002E
|
63
|
+
WM_CHARTOITEM = 0x002F
|
64
|
+
WM_SETFONT = 0x0030
|
65
|
+
WM_GETFONT = 0x0031
|
66
|
+
WM_SETHOTKEY = 0x0032
|
67
|
+
WM_GETHOTKEY = 0x0033
|
68
|
+
WM_QUERYDRAGICON = 0x0037
|
69
|
+
WM_COMPAREITEM = 0x0039
|
70
|
+
WM_COMPACTING = 0x0041
|
71
|
+
WM_COMMNOTIFY = 0x0044 #No longer supported
|
72
|
+
WM_WINDOWPOSCHANGING = 0x0046
|
73
|
+
WM_WINDOWPOSCHANGED = 0x0047
|
74
|
+
WM_POWER = 0x0048
|
75
|
+
WM_COPYDATA = 0x004A
|
76
|
+
WM_CANCELJOURNAL = 0x004B
|
77
|
+
WM_NOTIFY = 0x004E
|
78
|
+
WM_INPUTLANGCHANGEREQUEST = 0x0050
|
79
|
+
WM_INPUTLANGCHANGE = 0x0051
|
80
|
+
WM_TCARD = 0x0052
|
81
|
+
WM_HELP = 0x0053
|
82
|
+
WM_USERCHANGED = 0x0054
|
83
|
+
WM_NOTIFYFORMAT = 0x0055
|
84
|
+
WM_CONTEXTMENU = 0x007B
|
85
|
+
WM_STYLECHANGING = 0x007C
|
86
|
+
WM_STYLECHANGED = 0x007D
|
87
|
+
WM_DISPLAYCHANGE = 0x007E
|
88
|
+
WM_GETICON = 0x007F
|
89
|
+
WM_SETICON = 0x0080
|
90
|
+
WM_NCCREATE = 0x0081
|
91
|
+
WM_NCDESTROY = 0x0082
|
92
|
+
WM_NCCALCSIZE = 0x0083
|
93
|
+
WM_NCHITTEST = 0x0084
|
94
|
+
WM_NCPAINT = 0x0085
|
95
|
+
WM_NCACTIVATE = 0x0086
|
96
|
+
WM_GETDLGCODE = 0x0087
|
97
|
+
WM_NCMOUSEMOVE = 0x00A0
|
98
|
+
WM_NCLBUTTONDOWN = 0x00A1
|
99
|
+
WM_NCLBUTTONUP = 0x00A2
|
100
|
+
WM_NCLBUTTONDBLCLK = 0x00A3
|
101
|
+
WM_NCRBUTTONDOWN = 0x00A4
|
102
|
+
WM_NCRBUTTONUP = 0x00A5
|
103
|
+
WM_NCRBUTTONDBLCLK = 0x00A6
|
104
|
+
WM_NCMBUTTONDOWN = 0x00A7
|
105
|
+
WM_NCMBUTTONUP = 0x00A8
|
106
|
+
WM_NCMBUTTONDBLCLK = 0x00A9
|
107
|
+
WM_KEYFIRST = 0x0100
|
108
|
+
WM_KEYDOWN = 0x0100
|
109
|
+
WM_KEYUP = 0x0101
|
110
|
+
WM_CHAR = 0x0102
|
111
|
+
WM_DEADCHAR = 0x0103
|
112
|
+
WM_SYSKEYDOWN = 0x0104
|
113
|
+
WM_SYSKEYUP = 0x0105
|
114
|
+
WM_SYSCHAR = 0x0106
|
115
|
+
WM_SYSDEADCHAR = 0x0107
|
116
|
+
WM_KEYLAST = 0x0108
|
117
|
+
WM_IME_STARTCOMPOSITION = 0x010D
|
118
|
+
WM_IME_ENDCOMPOSITION = 0x010E
|
119
|
+
WM_IME_COMPOSITION = 0x010F
|
120
|
+
WM_IME_KEYLAST = 0x010F
|
121
|
+
WM_INITDIALOG = 0x0110
|
122
|
+
WM_COMMAND = 0x0111
|
123
|
+
WM_SYSCOMMAND = 0x0112
|
124
|
+
WM_TIMER = 0x0113
|
125
|
+
WM_HSCROLL = 0x0114
|
126
|
+
WM_VSCROLL = 0x0115
|
127
|
+
WM_INITMENU = 0x0116
|
128
|
+
WM_INITMENUPOPUP = 0x0117
|
129
|
+
WM_MENUSELECT = 0x011F
|
130
|
+
WM_MENUCHAR = 0x0120
|
131
|
+
WM_ENTERIDLE = 0x0121
|
132
|
+
WM_CTLCOLORMSGBOX = 0x0132
|
133
|
+
WM_CTLCOLOREDIT = 0x0133
|
134
|
+
WM_CTLCOLORLISTBOX = 0x0134
|
135
|
+
WM_CTLCOLORBTN = 0x0135
|
136
|
+
WM_CTLCOLORDLG = 0x0136
|
137
|
+
WM_CTLCOLORSCROLLBAR = 0x0137
|
138
|
+
WM_CTLCOLORSTATIC = 0x0138
|
139
|
+
WM_MOUSEFIRST = 0x0200
|
140
|
+
WM_MOUSEMOVE = 0x0200
|
141
|
+
WM_LBUTTONDOWN = 0x0201
|
142
|
+
WM_LBUTTONUP = 0x0202
|
143
|
+
WM_LBUTTONDBLCLK = 0x0203
|
144
|
+
WM_RBUTTONDOWN = 0x0204
|
145
|
+
WM_RBUTTONUP = 0x0205
|
146
|
+
WM_RBUTTONDBLCLK = 0x0206
|
147
|
+
WM_MBUTTONDOWN = 0x0207
|
148
|
+
WM_MBUTTONUP = 0x0208
|
149
|
+
WM_MBUTTONDBLCLK = 0x0209
|
150
|
+
WM_MOUSEWHEEL = 0x020A
|
151
|
+
WM_MOUSELAST = 0x0209
|
152
|
+
WM_PARENTNOTIFY = 0x0210
|
153
|
+
WM_ENTERMENULOOP = 0x0211
|
154
|
+
WM_EXITMENULOOP = 0x0212
|
155
|
+
WM_NEXTMENU = 0x0213
|
156
|
+
WM_SIZING = 0x0214
|
157
|
+
WM_CAPTURECHANGED = 0x0215
|
158
|
+
WM_MOVING = 0x0216
|
159
|
+
WM_POWERBROADCAST = 0x0218
|
160
|
+
WM_DEVICECHANGE = 0x0219
|
161
|
+
WM_IME_SETCONTEXT = 0x0281
|
162
|
+
WM_IME_NOTIFY = 0x0282
|
163
|
+
WM_IME_CONTROL = 0x0283
|
164
|
+
WM_IME_COMPOSITIONFULL = 0x0284
|
165
|
+
WM_IME_SELECT = 0x0285
|
166
|
+
WM_IME_CHAR = 0x0286
|
167
|
+
WM_IME_KEYDOWN = 0x0290
|
168
|
+
WM_IME_KEYUP = 0x0291
|
169
|
+
WM_MDICREATE = 0x0220
|
170
|
+
WM_MDIDESTROY = 0x0221
|
171
|
+
WM_MDIACTIVATE = 0x0222
|
172
|
+
WM_MDIRESTORE = 0x0223
|
173
|
+
WM_MDINEXT = 0x0224
|
174
|
+
WM_MDIMAXIMIZE = 0x0225
|
175
|
+
WM_MDITILE = 0x0226
|
176
|
+
WM_MDICASCADE = 0x0227
|
177
|
+
WM_MDIICONARRANGE = 0x0228
|
178
|
+
WM_MDIGETACTIVE = 0x0229
|
179
|
+
WM_MDISETMENU = 0x0230
|
180
|
+
WM_ENTERSIZEMOVE = 0x0231
|
181
|
+
WM_EXITSIZEMOVE = 0x0232
|
182
|
+
WM_DROPFILES = 0x0233
|
183
|
+
WM_MDIREFRESHMENU = 0x0234
|
184
|
+
WM_MOUSEHOVER = 0x02A1
|
185
|
+
WM_MOUSELEAVE = 0x02A3
|
186
|
+
WM_CUT = 0x0300
|
187
|
+
WM_COPY = 0x0301
|
188
|
+
WM_PASTE = 0x0302
|
189
|
+
WM_CLEAR = 0x0303
|
190
|
+
WM_UNDO = 0x0304
|
191
|
+
WM_RENDERFORMAT = 0x0305
|
192
|
+
WM_RENDERALLFORMATS = 0x0306
|
193
|
+
WM_DESTROYCLIPBOARD = 0x0307
|
194
|
+
WM_DRAWCLIPBOARD = 0x0308
|
195
|
+
WM_PAINTCLIPBOARD = 0x0309
|
196
|
+
WM_VSCROLLCLIPBOARD = 0x030A
|
197
|
+
WM_SIZECLIPBOARD = 0x030B
|
198
|
+
WM_ASKCBFORMATNAME = 0x030C
|
199
|
+
WM_CHANGECBCHAIN = 0x030D
|
200
|
+
WM_HSCROLLCLIPBOARD = 0x030E
|
201
|
+
WM_QUERYNEWPALETTE = 0x030F
|
202
|
+
WM_PALETTEISCHANGING = 0x0310
|
203
|
+
WM_PALETTECHANGED = 0x0311
|
204
|
+
WM_HOTKEY = 0x0312
|
205
|
+
WM_PRINT = 0x0317
|
206
|
+
WM_PRINTCLIENT = 0x0318
|
207
|
+
WM_HANDHELDFIRST = 0x0358
|
208
|
+
WM_HANDHELDLAST = 0x035F
|
209
|
+
WM_AFXFIRST = 0x0360
|
210
|
+
WM_AFXLAST = 0x037F
|
211
|
+
WM_PENWINFIRST = 0x0380
|
212
|
+
WM_PENWINLAST = 0x038F
|
213
|
+
|
214
|
+
WM_USER = 0x0400
|
215
|
+
MY_MESSAGE = WM_USER + 1
|
216
|
+
MY_OTHER_MESSAGE = WM_USER + 2
|
217
|
+
end
|
218
|
+
|
219
|
+
#Sends a window message to +self+ and waits for the window
|
220
|
+
#to process it.
|
221
|
+
#===Parameters
|
222
|
+
#[+msg+] The message to send. Either a constant from the Window::Messages module, or a symbol formed off a such name. For example, for WM_DESTROY you'd pass :destroy.
|
223
|
+
#[+info1+] (0) Additional message-specific information (wParam value).
|
224
|
+
#[+info2+] (0) Additional message-specific information (lParam value).
|
225
|
+
#===Return value
|
226
|
+
#The return value of the SendMessage() function.
|
227
|
+
#===Raises
|
228
|
+
#[Au3Error] Window not found.
|
229
|
+
#[Errno::EACCES] Windows's security policy blocked the function call.
|
230
|
+
#===Example
|
231
|
+
# win.send_message(:destroy) #Immediately destroys a window. No chance to save.
|
232
|
+
#You can find the additional paramters needed for each message at the Windows API docs at MSDN[http://msdn.microsoft.com/en-us/library/aa383749%28VS.85%29.aspx].
|
233
|
+
#I recommand you to query the search function with something like "WM_PAINT" if you want to know more about WM_PAINT.
|
234
|
+
def send_message(msg, info1 = 0, info2 = 0)
|
235
|
+
Window.functions[__method__] ||= Win32::API.new("SendMessage", 'LILL', 'L', "user32")
|
236
|
+
|
237
|
+
raise_unfound unless exists?
|
238
|
+
msg = Messages.const_get(:"WM_#{msg.to_s.upcase}") if msg.kind_of? Symbol
|
239
|
+
ret = Window.functions[__method__].call(self.to_i, msg, info1, info2)
|
240
|
+
Kernel.raise(Errno::EACCES, "The Windows UIPI blocked your function call.") if Window.functions[:get_last_error].call == 5
|
241
|
+
ret
|
242
|
+
end
|
243
|
+
|
244
|
+
#Puts a window message in +self+'s message queue and immediately returns.
|
245
|
+
#===Parameters
|
246
|
+
#[+msg+] The message to send. Either a constant from the Window::Messages module, or a symbol formed off a such name. For example, for WM_QUIT you'd pass :quit.
|
247
|
+
#[+info1+] (0) Additional message-specific information (wParam value).
|
248
|
+
#[+info2+] (0) Additional message-specific information (lParam value).
|
249
|
+
#===Return value
|
250
|
+
#The return value of the PostMessage() function.
|
251
|
+
#===Raises
|
252
|
+
#[Au3Error] Window not found.
|
253
|
+
#[Errno::EACCES] Windows's security policy blocked the function call.
|
254
|
+
#===Example
|
255
|
+
# win.post_message(:quit) #Request a window to exit. It doesn't have to obey, though.
|
256
|
+
#===Remarks
|
257
|
+
#You can find the additional paramters needed for each message at the Windows API docs at MSDN[http://msdn.microsoft.com/en-us/library/aa383749%28VS.85%29.aspx].
|
258
|
+
#I recommand you to query the search function with something like "WM_PAINT" if you want to know more about WM_PAINT.
|
259
|
+
def post_message(msg, info1 = 0, info2 = 0)
|
260
|
+
Window.functions[__method__] ||= Win32::API.new("PostMessage", 'LILL', 'I', "user32")
|
261
|
+
|
262
|
+
raise_unfound unless exists?
|
263
|
+
msg = Messages.const_get(:"WM_#{msg.to_s.upcase}") if msg.kind_of? Symbol
|
264
|
+
ret = Window.functions[__method__].call(self.to_i, msg, info1, info2)
|
265
|
+
Kernel.raise(Errno::EACCES, "The Windows UIPI blocked your function call.") if Window.functions[:get_last_error].call == 5
|
266
|
+
ret
|
267
|
+
end
|
268
|
+
|
269
|
+
end
|
270
|
+
|
271
|
+
end
|
data/lib/HISTORY.rdoc
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
=History of au3
|
2
2
|
Important changes are marked <b>bold</b>. Bugfixes are written <i>italic</i>.
|
3
|
+
|
4
|
+
==0.1.2
|
5
|
+
* Improved the documentation significantly.
|
6
|
+
* <i>Fixed a typo and a bug in window.rb which made Window.select_menu_item raising errors. Also enhanced documentation of this method. Thanks to sdavis26 for reporting. </i>
|
7
|
+
* <i>TreeView#send_command_to_tree_view raised an error when passed integer values. This has been fixed.</i>
|
8
|
+
* <i>The method AutoItX3::ListView#selected returned strings although thedocs said that it returned indices which are generally expectedto be numbers. This has been corrected; the method returns now an array of integers.</i>
|
9
|
+
* <i>Button#checked? always returned false. This has been fixed. </i>
|
10
|
+
* <i>Window#client_size always raised an ArgumentError. This has been fixed. </i>
|
11
|
+
* <b>Added the Window#send_message and Window#post_message methods. Since they belong rather to automation in general than to AutoIt in special, they reside in an extra file 'AutoItX3/window/send_message.rb' which you have to require first in order to get them.</b>
|
12
|
+
|
3
13
|
==0.1.1
|
4
14
|
* Corrected documentation main page set by the Rakefile
|
5
15
|
* <b>Added ##method_missing to the AutoItX3 module to allow shortcuts like <tt>AutoItX3.ctrl_c</tt>. </b>
|
data/lib/README.rdoc
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
-- Encoding: UTF-8 ++
|
1
2
|
=au3
|
2
3
|
<tt>.au3</tt> is the usual file extension for {AutoIt version 3}[http://www.autoitscript.com/autoit3/index.shtml]
|
3
4
|
scripts. That this library uses it as its name, tells a lot about
|
@@ -20,6 +21,15 @@ Or, if you don't want to copy the file over and over again, put it in your Ruby'
|
|
20
21
|
bin directory. If you want to deploy your program, the final recipient need not
|
21
22
|
to have AutoIt installed - it's enough if you just include the AutoItX3.dll in your
|
22
23
|
application (and make sure you've read the AutoItX3 license - it's quite short).
|
24
|
+
==Win32API problems:
|
25
|
+
You may get an error message similar to this after requiring 'au3':
|
26
|
+
The specified module was not found.
|
27
|
+
This message also appears if you just require "win32/api", it's therefore not a problem with au3.
|
28
|
+
The simplest solution is to gem uninstall win32-api followed by
|
29
|
+
gem install win32-api --platform=ruby
|
30
|
+
which forces RubyGems to compile win32-api from source. Of course, in order to
|
31
|
+
do this you need to have a C compiler, for example from the RubyInstaller devkit or
|
32
|
+
MinGW/MSYS directly.
|
23
33
|
==Usage
|
24
34
|
The majority of +au3+'s methods is bundled in the AutoItX3 module
|
25
35
|
and accessable via it's module methods. In order to get them,
|
@@ -53,12 +63,27 @@ wrapped in the AutoItX3::Control class.
|
|
53
63
|
edit = window.focused_control
|
54
64
|
#Set the text. You should also have a look on the AutoItX3.send_keys method.
|
55
65
|
edit.text = "ABCDEFG"
|
66
|
+
|
67
|
+
If you like to play with window messages directly, require 'AutoItX3/window/send_message' which
|
68
|
+
leaves the scope of AutoIt behind and directly wraps some Win32API functions. You get two new instance
|
69
|
+
methods for the AutoItX3::Window class, #post_message and #send_message, and now you can enjoy
|
70
|
+
doing things like
|
71
|
+
require "au3"
|
72
|
+
require "AutoItX3/window/send_message"
|
73
|
+
#...
|
74
|
+
win.post_message(:close)
|
75
|
+
. See the method's documentations for more information on this.
|
56
76
|
===Don't know where to start?
|
57
77
|
Have a look at the documentation of the AutoItX3 module.
|
58
78
|
+au3+ is well documented and even if you don't find something
|
59
79
|
useful, you may just want to play around with it. ;-)
|
60
80
|
==Copyright
|
61
|
-
Copyright © 2009 Marvin Gülker
|
81
|
+
Copyright © 2009, 2010 Marvin Gülker, Steven Heidel
|
82
|
+
|
83
|
+
Contact:
|
84
|
+
Marvin Gülker (Quintus): sutniuq@@gmx@net
|
85
|
+
Steven Heidel (stevenheidel): steven@@livingskyweb@ca
|
86
|
+
|
62
87
|
Licensed under the same terms as Ruby (see http://www.ruby-lang.org/en/LICENSE.txt )
|
63
88
|
Initia in potestate nostra sunt, de eventu fortuna iudicat.
|
64
89
|
==License
|
data/lib/au3.rb
CHANGED
data/test/test_misc.rb
CHANGED
@@ -34,7 +34,7 @@ class MiscTest < Test::Unit::TestCase
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def test_opt
|
37
|
-
AutoItX3.run("mspaint.exe")
|
37
|
+
pid = AutoItX3.run("mspaint.exe")
|
38
38
|
AutoItX3.opt("WinTitleMatchMode", 2) do
|
39
39
|
assert(AutoItX3::Window.wait("Paint", "", 3)) #Timeout means false
|
40
40
|
end
|
@@ -43,6 +43,7 @@ class MiscTest < Test::Unit::TestCase
|
|
43
43
|
assert(AutoItX3::Window.wait("Paint", "", 3))
|
44
44
|
AutoItX3.opt("WinTitleMatchMode", 1)
|
45
45
|
assert_equal(false, AutoItX3::Window.wait("Paint", "", 3))
|
46
|
+
AutoItX3.kill_process(pid)
|
46
47
|
end
|
47
48
|
|
48
49
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#Encoding: UTF-8
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright © 2009, 2010 Marvin Gülker, Steven Heidel
|
4
|
+
#
|
5
|
+
#au3 is published under the same terms as Ruby.
|
6
|
+
#See http://www.ruby-lang.org/en/LICENSE.txt
|
7
|
+
|
8
|
+
begin
|
9
|
+
require_relative "../lib/au3"
|
10
|
+
require_relative "../lib/AutoItX3/window/send_message"
|
11
|
+
rescue LoadError
|
12
|
+
#Aha, this is the gem, not the build environment
|
13
|
+
require "au3"
|
14
|
+
require "AutoItX3/window/send_message"
|
15
|
+
end
|
16
|
+
require "test/unit"
|
17
|
+
|
18
|
+
class WindowCommandTest < Test::Unit::TestCase
|
19
|
+
|
20
|
+
def self.startup
|
21
|
+
AutoItX3.opt("WinTitleMatchMode", 2)
|
22
|
+
end
|
23
|
+
|
24
|
+
def setup
|
25
|
+
AutoItX3.run("mspaint")
|
26
|
+
sleep 1
|
27
|
+
@win = AutoItX3::Window.new("Paint")
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_send_message
|
31
|
+
@win.send_message(:close)
|
32
|
+
sleep 0.5
|
33
|
+
assert(!@win.exists?)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_post_message
|
37
|
+
@win.post_message(:close)
|
38
|
+
sleep 0.5
|
39
|
+
assert(!@win.exists?)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
metadata
CHANGED
@@ -1,40 +1,56 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: au3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
|
-
- Marvin
|
13
|
+
- "Marvin G\xC3\xBClker, Steven Heidel"
|
8
14
|
autorequire:
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-06-13 00:00:00 +02:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: win32-api
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 4
|
23
33
|
version: "1.4"
|
24
|
-
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: test-unit
|
27
|
-
|
28
|
-
|
29
|
-
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
30
41
|
requirements:
|
31
42
|
- - ">="
|
32
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 0
|
33
48
|
version: "2.0"
|
34
|
-
|
49
|
+
type: :development
|
50
|
+
version_requirements: *id002
|
35
51
|
description: " au3 is a gem that provides Ruby bindings to the AutoIt Windows automation tool by \n\
|
36
52
|
using it's DLL interface AutoItX. \n"
|
37
|
-
email: sutniuq@gmx.net
|
53
|
+
email: sutniuq@gmx.net, steven@livingskyweb.ca
|
38
54
|
executables: []
|
39
55
|
|
40
56
|
extensions: []
|
@@ -50,6 +66,7 @@ files:
|
|
50
66
|
- test/test_mouse.rb
|
51
67
|
- test/test_process.rb
|
52
68
|
- test/test_window.rb
|
69
|
+
- test/test_window_messages.rb
|
53
70
|
- lib/HISTORY.rdoc
|
54
71
|
- lib/README.rdoc
|
55
72
|
- lib/au3.rb
|
@@ -62,8 +79,9 @@ files:
|
|
62
79
|
- lib/AutoItX3/mouse.rb
|
63
80
|
- lib/AutoItX3/process.rb
|
64
81
|
- lib/AutoItX3/window.rb
|
82
|
+
- lib/AutoItX3/window/send_message.rb
|
65
83
|
has_rdoc: true
|
66
|
-
homepage: http://
|
84
|
+
homepage: http://auto.rubyforge.org/
|
67
85
|
licenses: []
|
68
86
|
|
69
87
|
post_install_message:
|
@@ -75,22 +93,29 @@ rdoc_options:
|
|
75
93
|
require_paths:
|
76
94
|
- lib
|
77
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
96
|
+
none: false
|
78
97
|
requirements:
|
79
98
|
- - ">="
|
80
99
|
- !ruby/object:Gem::Version
|
100
|
+
hash: 29
|
101
|
+
segments:
|
102
|
+
- 1
|
103
|
+
- 9
|
81
104
|
version: "1.9"
|
82
|
-
version:
|
83
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
84
107
|
requirements:
|
85
108
|
- - ">="
|
86
109
|
- !ruby/object:Gem::Version
|
110
|
+
hash: 3
|
111
|
+
segments:
|
112
|
+
- 0
|
87
113
|
version: "0"
|
88
|
-
version:
|
89
114
|
requirements:
|
90
115
|
- Microsoft Windows
|
91
116
|
- AutoItX3.dll from AutoIt3
|
92
117
|
rubyforge_project: Automations
|
93
|
-
rubygems_version: 1.3.
|
118
|
+
rubygems_version: 1.3.7
|
94
119
|
signing_key:
|
95
120
|
specification_version: 3
|
96
121
|
summary: A binding to the AutoItX3 Windows automation tool.
|
@@ -103,3 +128,4 @@ test_files:
|
|
103
128
|
- test/test_mouse.rb
|
104
129
|
- test/test_process.rb
|
105
130
|
- test/test_window.rb
|
131
|
+
- test/test_window_messages.rb
|