au3 0.0.1-x86-mingw32
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/ext/README.rdoc +84 -0
- data/ext/au3.c +2225 -0
- data/ext/au3.o +0 -0
- data/ext/au3.so +0 -0
- data/ext/extconf.rb +14 -0
- data/ext/parts/control.c +628 -0
- data/ext/parts/filedir.c +121 -0
- data/ext/parts/graphic.c +51 -0
- data/ext/parts/keyboard.c +29 -0
- data/ext/parts/misc.c +107 -0
- data/ext/parts/mouse.c +130 -0
- data/ext/parts/process.c +143 -0
- data/ext/parts/utils.c +53 -0
- data/ext/parts/wconv.c +40 -0
- data/ext/parts/window.c +497 -0
- data/test/test_clipboard.rb +19 -0
- data/test/test_ini.rb +48 -0
- data/test/test_keyboard.rb +61 -0
- data/test/test_mouse.rb +43 -0
- data/test/test_process.rb +50 -0
- data/test/test_tray.rb +29 -0
- data/test/test_window.rb +104 -0
- metadata +88 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
#Encoding: Windows-1252
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright (c) 2009 Marvin G�lker
|
4
|
+
begin
|
5
|
+
require "../ext/au3"
|
6
|
+
rescue LoadError
|
7
|
+
#Aha, this is the gem, not the build environment
|
8
|
+
require "au3"
|
9
|
+
end
|
10
|
+
require "test/unit"
|
11
|
+
|
12
|
+
class ClipboardTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
def test_clipboard
|
15
|
+
AutoItX3.cliptext = "HDGDL"
|
16
|
+
assert_equal("HDGDL", AutoItX3.cliptext)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
data/test/test_ini.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
#Encoding: Windows-1252
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright (c) 2009 Marvin G�lker
|
4
|
+
begin
|
5
|
+
require "../ext/au3"
|
6
|
+
rescue LoadError
|
7
|
+
#Aha, this is the gem, not the build environment
|
8
|
+
require "au3"
|
9
|
+
end
|
10
|
+
require "test/unit"
|
11
|
+
|
12
|
+
class IniTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
TEST_INI =<<EOF
|
15
|
+
[Section1]
|
16
|
+
key1=val1
|
17
|
+
[Section2]
|
18
|
+
key1=val2
|
19
|
+
EOF
|
20
|
+
|
21
|
+
INI_NAME = "test.ini"
|
22
|
+
|
23
|
+
def self.startup
|
24
|
+
File.open(INI_NAME, "w"){|f| f.write(TEST_INI)}
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_read
|
28
|
+
assert_equal("val1", AutoItX3.read_ini_entry(INI_NAME, "Section1", "key1", ""))
|
29
|
+
assert_equal("val2", AutoItX3.read_ini_entry(INI_NAME, "Section2", "key1", ""))
|
30
|
+
assert_equal("XXX", AutoItX3.read_ini_entry(INI_NAME, "Section3", "key1", "XXX"))
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_write
|
34
|
+
AutoItX3.write_ini_entry(INI_NAME, "NewSection", "key", "aValue")
|
35
|
+
assert_equal("aValue", AutoItX3.read_ini_entry(INI_NAME, "NewSection", "key", ""))
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_delete
|
39
|
+
AutoItX3.write_ini_entry(INI_NAME, "ASection", "key", "aValue")
|
40
|
+
AutoItX3.delete_ini_entry(INI_NAME, "ASection", "key")
|
41
|
+
assert_equal("XXX", AutoItX3.read_ini_entry(INI_NAME, "ASection", "key", "XXX"))
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.shutdown
|
45
|
+
File.delete(INI_NAME)
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#Encoding: Windows-1252
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright (c) 2009 Marvin G�lker
|
4
|
+
begin
|
5
|
+
require "../ext/au3"
|
6
|
+
rescue LoadError
|
7
|
+
#Aha, this is the gem, not the build environment
|
8
|
+
require "au3"
|
9
|
+
end
|
10
|
+
require "test/unit"
|
11
|
+
|
12
|
+
class KeyboardTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
TEXT1 = "abc"
|
15
|
+
TEXT2 = "One with\nNewline"
|
16
|
+
TEXT3 = "With{TAB}tab"
|
17
|
+
|
18
|
+
def setup
|
19
|
+
@pid = AutoItX3.run("notepad", "", AutoItX3::Window::SW_MAXIMIZE)
|
20
|
+
sleep 2
|
21
|
+
AutoItX3.mouse_click(150, 150)
|
22
|
+
end
|
23
|
+
|
24
|
+
def teardown
|
25
|
+
AutoItX3.kill_process(@pid)
|
26
|
+
sleep 1
|
27
|
+
end
|
28
|
+
|
29
|
+
def copy_all
|
30
|
+
AutoItX3.send_keys("^a")
|
31
|
+
AutoItX3.msleep(200)
|
32
|
+
AutoItX3.send_keys("^c")
|
33
|
+
AutoItX3.msleep(200)
|
34
|
+
end
|
35
|
+
|
36
|
+
def delete_all
|
37
|
+
AutoItX3.send_keys("^a")
|
38
|
+
AutoItX3.msleep(200)
|
39
|
+
AutoItX3.send_keys("{BS}")
|
40
|
+
AutoItX3.msleep(200)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_send
|
44
|
+
AutoItX3.send_keys(TEXT1)
|
45
|
+
copy_all
|
46
|
+
assert_equal(TEXT1, AutoItX3.cliptext)
|
47
|
+
delete_all
|
48
|
+
AutoItX3.send_keys(TEXT2)
|
49
|
+
copy_all
|
50
|
+
assert_equal(TEXT2.sub("\n", "\r\n"), AutoItX3.cliptext)
|
51
|
+
delete_all
|
52
|
+
AutoItX3.send_keys(TEXT3)
|
53
|
+
copy_all
|
54
|
+
assert_equal(TEXT3.sub("{TAB}", "\t"), AutoItX3.cliptext)
|
55
|
+
delete_all
|
56
|
+
AutoItX3.send_keys(TEXT3, true)
|
57
|
+
copy_all
|
58
|
+
assert_equal(TEXT3, AutoItX3.cliptext)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
data/test/test_mouse.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#Encoding: Windows-1252
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright (c) 2009 Marvin G�lker
|
4
|
+
begin
|
5
|
+
require "../ext/au3"
|
6
|
+
rescue LoadError
|
7
|
+
#Aha, this is the gem, not the build environment
|
8
|
+
require "au3"
|
9
|
+
end
|
10
|
+
require "test/unit"
|
11
|
+
|
12
|
+
class MouseTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
THREADS = []
|
15
|
+
|
16
|
+
def self.shutdown
|
17
|
+
THREADS.each{|t| t.join}
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_cursor_id
|
21
|
+
pid = AutoItX3.run("notepad", "", AutoItX3::Window::SW_MAXIMIZE)
|
22
|
+
AutoItX3.move_mouse(150, 150)
|
23
|
+
THREADS << Thread.new{sleep 1;AutoItX3.kill_process(pid)}
|
24
|
+
assert_equal(AutoItX3::IBEAM_CURSOR, AutoItX3.cursor_id)
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_move_curpos
|
28
|
+
AutoItX3.move_mouse(23, 74)
|
29
|
+
assert_equal([23, 74], AutoItX3.cursor_pos)
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_click
|
33
|
+
pid = AutoItX3.run("notepad", "", AutoItX3::Window::SW_MAXIMIZE)
|
34
|
+
AutoItX3.mouse_click(1000000, 5) #End of screen
|
35
|
+
THREADS << Thread.new{sleep 1;AutoItX3.kill_process(pid)}
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_tooltip
|
39
|
+
assert_nil(AutoItX3.tooltip("Google is watching you!"))
|
40
|
+
sleep 1
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#Encoding: Windows-1252
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright (c) 2009 Marvin G�lker
|
4
|
+
begin
|
5
|
+
require "../ext/au3"
|
6
|
+
rescue LoadError
|
7
|
+
#Aha, this is the gem, not the build environment
|
8
|
+
require "au3"
|
9
|
+
end
|
10
|
+
require "test/unit"
|
11
|
+
|
12
|
+
class ProcessTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
DUMMY_PROG =<<EOF
|
15
|
+
#Encoding: Windows-1252
|
16
|
+
loop{sleep 1}
|
17
|
+
EOF
|
18
|
+
|
19
|
+
def self.startup
|
20
|
+
AutoItX3.opt("WinTitleMatchMode", 2)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_exists
|
24
|
+
assert_equal($$, AutoItX3.process_exists?($$))
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_kill
|
28
|
+
File.open("dummy.rb", "w"){|f| f.write(DUMMY_PROG)}
|
29
|
+
pid = AutoItX3.run("ruby dummy.rb")
|
30
|
+
sleep 1
|
31
|
+
assert_equal(pid, AutoItX3.process_exists?(pid))
|
32
|
+
AutoItX3.kill_process(pid)
|
33
|
+
sleep 1
|
34
|
+
assert_equal(false, AutoItX3.process_exists?(pid))
|
35
|
+
File.delete("dummy.rb")
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_wait
|
39
|
+
pid = AutoItX3.run("mspaint")
|
40
|
+
assert(AutoItX3.wait_for_process("mspaint.exe", 5))
|
41
|
+
sleep 1
|
42
|
+
AutoItX3.kill_process(pid)
|
43
|
+
assert(AutoItX3.wait_for_process_close("mspaint.exe", 2))
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_run_and_wait
|
47
|
+
assert_equal(1, AutoItX3.run_and_wait("dir gibtsnich"))
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
data/test/test_tray.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#Encoding: Windows-1252
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright (c) 2009 Marvin G�lker
|
4
|
+
begin
|
5
|
+
require "../ext/au3"
|
6
|
+
rescue LoadError
|
7
|
+
#Aha, this is the gem, not the build environment
|
8
|
+
require "au3"
|
9
|
+
end
|
10
|
+
require "test/unit"
|
11
|
+
|
12
|
+
class CDTrayTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
TEST_TRAY = "E:"
|
15
|
+
|
16
|
+
def test_open
|
17
|
+
assert(AutoItX3.open_cd_tray(TEST_TRAY))
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_close
|
21
|
+
AutoItX3.open_cd_tray(TEST_TRAY)
|
22
|
+
if !AutoItX3.close_cd_tray(TEST_TRAY)
|
23
|
+
notify "Could not close your CD tray. Are you running on a laptop?"
|
24
|
+
else
|
25
|
+
assert(true)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
data/test/test_window.rb
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
#Encoding: Windows-1252
|
2
|
+
#This file is part of au3.
|
3
|
+
#Copyright (c) 2009 Marvin G�lker
|
4
|
+
begin
|
5
|
+
require "../ext/au3"
|
6
|
+
rescue LoadError
|
7
|
+
#Aha, this is the gem, not the build environment
|
8
|
+
require "au3"
|
9
|
+
end
|
10
|
+
require "test/unit"
|
11
|
+
|
12
|
+
class WindowTest < Test::Unit::TestCase
|
13
|
+
|
14
|
+
THREADS = []
|
15
|
+
|
16
|
+
def self.startup
|
17
|
+
AutoItX3.opt("WinTitleMatchMode", 2)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.shutdown
|
21
|
+
THREADS.each{|t| t.join}
|
22
|
+
end
|
23
|
+
|
24
|
+
def setup
|
25
|
+
@pid = AutoItX3.run("mspaint")
|
26
|
+
AutoItX3::Window.wait("Paint")
|
27
|
+
@win = AutoItX3::Window.new("Paint")
|
28
|
+
end
|
29
|
+
|
30
|
+
def teardown
|
31
|
+
@win.kill
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_exists
|
35
|
+
assert_true(AutoItX3::Window.exists?(@win.title))
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_activate
|
39
|
+
pid = AutoItX3.run("calc")
|
40
|
+
THREADS << Thread.new{sleep 3; AutoItX3.kill_process(pid)}
|
41
|
+
sleep 1
|
42
|
+
assert_equal(false, @win.active?)
|
43
|
+
@win.activate
|
44
|
+
sleep 1
|
45
|
+
assert_true(@win.active?)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_states
|
49
|
+
@win.state = AutoItX3::Window::SW_MINIMIZE
|
50
|
+
sleep 1
|
51
|
+
assert_true(@win.minimized?)
|
52
|
+
@win.state = AutoItX3::Window::SW_RESTORE
|
53
|
+
sleep 1
|
54
|
+
assert_equal(false, @win.minimized?)
|
55
|
+
@win.state = AutoItX3::Window::SW_MAXIMIZE
|
56
|
+
sleep 1
|
57
|
+
assert_true(@win.maximized?)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_move_and_resize
|
61
|
+
@win.move(37, 45, 200, 200)
|
62
|
+
sleep 1
|
63
|
+
assert_equal([37, 45], @win.rect[0..1])
|
64
|
+
@win.move(0, 0, 420, 450)
|
65
|
+
sleep 1
|
66
|
+
assert_equal([0, 0, 420, 450], @win.rect)
|
67
|
+
end
|
68
|
+
|
69
|
+
def test_pid
|
70
|
+
assert_equal(@pid, @win.pid)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_statusbar_text
|
74
|
+
assert_compare(0, "<", @win.statusbar_text.size)
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_text
|
78
|
+
assert_compare(0, "<", @win.text.size)
|
79
|
+
end
|
80
|
+
|
81
|
+
def test_title
|
82
|
+
assert_match(/Paint/, @win.title)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_to_i
|
86
|
+
assert_equal(@win.handle.to_i(16), @win.to_i)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_transparency
|
90
|
+
assert_equal(100, @win.transparency = 100)
|
91
|
+
sleep 1
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_visible
|
95
|
+
assert_true(@win.visible?)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_close
|
99
|
+
@win.close
|
100
|
+
assert_true(@win.wait_not_active)
|
101
|
+
assert_true(@win.wait_close)
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: au3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: x86-mingw32
|
6
|
+
authors:
|
7
|
+
- Marvin Guelker
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-09-09 00:00:00 +02:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: |
|
17
|
+
au3 is a gem that provides Ruby bindings to the AutoIt Windows automation tool by
|
18
|
+
using it's DLL interface AutoItX.
|
19
|
+
|
20
|
+
email: sutniuq@gmx.net
|
21
|
+
executables: []
|
22
|
+
|
23
|
+
extensions: []
|
24
|
+
|
25
|
+
extra_rdoc_files: []
|
26
|
+
|
27
|
+
files:
|
28
|
+
- ext/README.rdoc
|
29
|
+
- ext/au3.o
|
30
|
+
- ext/au3.so
|
31
|
+
- ext/au3.c
|
32
|
+
- ext/extconf.rb
|
33
|
+
- ext/parts/control.c
|
34
|
+
- ext/parts/filedir.c
|
35
|
+
- ext/parts/graphic.c
|
36
|
+
- ext/parts/keyboard.c
|
37
|
+
- ext/parts/misc.c
|
38
|
+
- ext/parts/mouse.c
|
39
|
+
- ext/parts/process.c
|
40
|
+
- ext/parts/utils.c
|
41
|
+
- ext/parts/wconv.c
|
42
|
+
- ext/parts/window.c
|
43
|
+
- test/test_clipboard.rb
|
44
|
+
- test/test_ini.rb
|
45
|
+
- test/test_keyboard.rb
|
46
|
+
- test/test_mouse.rb
|
47
|
+
- test/test_process.rb
|
48
|
+
- test/test_tray.rb
|
49
|
+
- test/test_window.rb
|
50
|
+
has_rdoc: true
|
51
|
+
homepage:
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options:
|
56
|
+
- " -m ext/README.rdoc"
|
57
|
+
- -t 'au3 RDocs'
|
58
|
+
- -c Windows-1252
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
- ext
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "1.8"
|
67
|
+
version:
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "0"
|
73
|
+
version:
|
74
|
+
requirements:
|
75
|
+
- Microsoft Windows
|
76
|
+
rubyforge_project: Automations
|
77
|
+
rubygems_version: 1.3.5
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: A binding to the AutoItX3 Windows automation tool.
|
81
|
+
test_files:
|
82
|
+
- test/test_clipboard.rb
|
83
|
+
- test/test_ini.rb
|
84
|
+
- test/test_keyboard.rb
|
85
|
+
- test/test_mouse.rb
|
86
|
+
- test/test_process.rb
|
87
|
+
- test/test_tray.rb
|
88
|
+
- test/test_window.rb
|