autoit 0.2.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.MD +6 -3
- data/Gemfile +2 -2
- data/Gemfile.lock +4 -4
- data/README.md +144 -10
- data/Rakefile +12 -6
- data/autoit.gemspec +29 -17
- data/bin/autoit +3 -1
- data/bin/console +4 -4
- data/lib/autoit.rb +3 -3
- data/lib/autoit/control.rb +50 -32
- data/lib/autoit/install.rb +18 -0
- data/lib/autoit/version.rb +1 -1
- data/rubocop.yml +3 -0
- data/vendor/register32.bat +32 -0
- data/vendor/register64.bat +32 -0
- metadata +35 -20
- data/.byebug_history +0 -39
- data/lib/autoit/cli.rb +0 -17
- data/vendor/register.bat +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5043bf7dfa3ded0a8fb005a7dcea65637c02194b
|
4
|
+
data.tar.gz: c7b823e84ec8066a683ed75f980c9670644a297e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8aa86b1df27cf935cc8280e691ab2dc2c90e6ab416dd9efd9936ae4657f9aa72066ef9be6f1a3b7f391caab18b281f1432db1a0dfac65ff3f0f1bc73ea7d46cd
|
7
|
+
data.tar.gz: ea4a027d4bc59fd0b78f31d874d373a1c77edbc99039cca8efe4eb99dc3fcce227eb0eec8a500d0729a1d1494d3f6c5e0399a157fd06627dbd64b4474f973f2c
|
data/.gitignore
CHANGED
data/CHANGELOG.MD
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
##
|
1
|
+
## 1.0.0 (2018-11-09)
|
2
2
|
|
3
3
|
Changes:
|
4
4
|
|
5
|
-
-
|
5
|
+
- Released first functional version using natives commands. Check this on README file.
|
6
|
+
- Implemented a built-in executable to install AutoIt DLLS on your OS: autoit install
|
7
|
+
- Wrapper methods to check texts and integers, to open app, close windows, open apps and clicks on
|
8
|
+
- command method to run native AutoIt commands
|
6
9
|
|
7
10
|
Bugfixes:
|
8
11
|
|
@@ -10,4 +13,4 @@ Bugfixes:
|
|
10
13
|
|
11
14
|
Documentation:
|
12
15
|
|
13
|
-
-
|
16
|
+
- Created a complete version of README file
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in autoit.gemspec
|
6
6
|
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
autoit (0.
|
5
|
-
|
4
|
+
autoit (0.2.0)
|
5
|
+
os
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -10,6 +10,7 @@ GEM
|
|
10
10
|
ast (2.4.0)
|
11
11
|
byebug (10.0.2)
|
12
12
|
minitest (5.11.3)
|
13
|
+
os (1.0.0)
|
13
14
|
parallel (1.12.1)
|
14
15
|
parser (2.5.3.0)
|
15
16
|
ast (~> 2.4.0)
|
@@ -25,7 +26,6 @@ GEM
|
|
25
26
|
ruby-progressbar (~> 1.7)
|
26
27
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
27
28
|
ruby-progressbar (1.10.0)
|
28
|
-
thor (0.20.0)
|
29
29
|
unicode-display_width (1.4.0)
|
30
30
|
|
31
31
|
PLATFORMS
|
@@ -37,7 +37,7 @@ DEPENDENCIES
|
|
37
37
|
byebug (~> 10.0)
|
38
38
|
minitest (~> 5.0)
|
39
39
|
rake (~> 10.0)
|
40
|
-
rubocop (
|
40
|
+
rubocop (>= 0.49.0)
|
41
41
|
|
42
42
|
BUNDLED WITH
|
43
43
|
1.16.6
|
data/README.md
CHANGED
@@ -1,10 +1,27 @@
|
|
1
|
-
|
1
|
+
![AutoIt Logo](https://www.autoitscript.com/images/logo_autoit_210x72@2x.png "AutoIt Logo")Ruby Version
|
2
2
|
|
3
|
-
|
3
|
+
#
|
4
|
+
AutoIt is a gem to handle and integrate Windows Automation in your project and tests using the AutoIt software and Windows OLE
|
5
|
+
objects. With AutoIt gem you can run easily wrapper methods or run natives AutoIt commands.
|
4
6
|
|
5
|
-
|
7
|
+
>We are building a new concept to match Windows elements called WPath. Yes, this is similar to the known XPath and we are
|
8
|
+
trying to bring this feature to easily find elements on the screen. For example: `//Calculator/Button[@id=135]` will match an
|
9
|
+
element on the screen with title 'Calculator', with class Button and ID 135.
|
6
10
|
|
7
|
-
|
11
|
+
We recommend to build a project structure using BDD Cucumber (http://cucumber.io) with the gem BDDFire (https://github.com/Shashikant86/bddfire) to have a complete and full of features tool for your automation project focused highly on your business, not just in code.
|
12
|
+
|
13
|
+
Enjoy this awesome project together. Use, review, contribute and give us a <a class="github-button" href="https://github.com/rpossan/autoit" data-icon="octicon-star" aria-label="Star rpossan/autoit on GitHub">STAR</a>!
|
14
|
+
|
15
|
+
1. [Installation](#1---installation)
|
16
|
+
2. [Usage](#2---usage)
|
17
|
+
3. [Basics - Getting started](#3---basics---getting-started)
|
18
|
+
4. [Development](#4---development)
|
19
|
+
5. [Contributing](#5---contributing)
|
20
|
+
6. [License](#6---license)
|
21
|
+
7. [Code of Conduct](#7---code-of-conduct)
|
22
|
+
8. [Support](#8---support)
|
23
|
+
|
24
|
+
## 1 - Installation
|
8
25
|
|
9
26
|
Add this line to your application's Gemfile:
|
10
27
|
|
@@ -20,24 +37,141 @@ Or install it yourself as:
|
|
20
37
|
|
21
38
|
$ gem install autoit
|
22
39
|
|
23
|
-
|
40
|
+
AutoIt Installation:
|
41
|
+
|
42
|
+
AutoIt gem has a executable 'autoit' with the command 'install' to install the AutoIt DLL's for Operating System 32 or 64 bits.
|
43
|
+
|
44
|
+
You can install autoit manually by yourself following the instructions: https://www.autoitscript.com/site/autoit/downloads/
|
45
|
+
|
46
|
+
If you have already installed AutoIt DLLs on your system ignore this step.
|
47
|
+
|
48
|
+
DLLs are located and will be up to date on the folder: https://github.com/rpossan/autoit/tree/master/vendor
|
49
|
+
|
50
|
+
```sh
|
51
|
+
$ autoit install
|
52
|
+
```
|
53
|
+
|
54
|
+
System will ask for Administrator access. Click on "Yes" to register the properly DLL on your system register.
|
55
|
+
|
56
|
+
![](https://github.com/rpossan/files/blob/master/autoit/autoit_install.gif)
|
57
|
+
|
58
|
+
## 2 - Usage
|
59
|
+
|
60
|
+
The basics of usage is very simples.
|
61
|
+
First step you need to instance an object (or call directly) from the class Control of AutoIt module.
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
control = AutoIt::Control.new
|
65
|
+
```
|
66
|
+
|
67
|
+
Once object instanced, you can call the method "command" to run native AutoIt commands exactly how you can see in the
|
68
|
+
AutoIt library documentation: https://www.autoitscript.com/autoit3/docs/functions/.
|
69
|
+
|
70
|
+
First argument of this method is the command that you want to run following of the AutoIt function arguments.
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
control.command('run', ['calc']) # Open the Windows calculator
|
74
|
+
|
75
|
+
# Click on element located by 'Calculator' title, '8' text and ID 138
|
76
|
+
control.command('ControlClick', ['Calculator', '8', '[ID:138]'])
|
77
|
+
```
|
78
|
+
This example of use is exaclty as AutoIt ControlClick funtcion documentation: https://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm
|
79
|
+
|
80
|
+
Using ruby wrapper methods:
|
81
|
+
|
82
|
+
>_This is UNDER construction - Keep your autoit gem up to date to get all features)_
|
83
|
+
```ruby
|
84
|
+
# Open app and run executables
|
85
|
+
control.open_app('calc') # open Windows calculator. Can be a executable or path to an .exe file
|
86
|
+
|
87
|
+
# Closing windows
|
88
|
+
control.win_close 'Calculator' # close window with title 'Calculator'
|
89
|
+
|
90
|
+
# Clicking elements
|
91
|
+
control.click_on('Calculator', '[ID:135]', '5') # click on element with window title 'Calculator', ID 135 and text '5'
|
92
|
+
control.click_on('135') # Click on first element found with id 135
|
93
|
+
control.click_on({class: "Button", instance: 9, id: 138, text: "5"}) #Using a hash of arguments
|
94
|
+
control.click_on('//Calculator[@id=135]') # Using WPath - Our innovative way to match elements by paths, similar to XPath for HTML
|
95
|
+
|
96
|
+
# Check if it has a given integer value on the window with title Calculator
|
97
|
+
control.has_int?('Calculator', 10)
|
98
|
+
|
99
|
+
# Check if it has a given text on the window with title Calculator
|
100
|
+
control.has_int?('Calculator', "MC")
|
101
|
+
```
|
102
|
+
|
103
|
+
Example of how to automate the sum using the Windows Calculator with wrapper methods:
|
104
|
+
```ruby
|
105
|
+
my_control = AutoIt::Control.new # instance object
|
106
|
+
my_control.click_on('Calculator', '[ID:135]', '5') # click on '5'
|
107
|
+
my_control.click_on('Calculator', '[ID:93]', '+') # click on '+'
|
108
|
+
my_control.click_on('Calculator', '[ID:135]', '5') # click on '5'
|
109
|
+
my_control.click_on('Calculator', '[ID:121]', '=') # click on '='
|
110
|
+
|
111
|
+
if my_control.has_int?('Calculator', 10)
|
112
|
+
puts "Yes, I see 10 text on the the result element!"
|
113
|
+
end
|
114
|
+
|
115
|
+
my_control.win_close 'Calculator' # Close window with 'Calculator' title
|
116
|
+
```
|
117
|
+
|
118
|
+
Same example but now using native commands of AutoIt DLL:
|
119
|
+
```ruby
|
120
|
+
my_control = AutoIt::Control.new # instance object
|
121
|
+
key_8 = ['Calculator', '8', '[ID:138]'] # An array with options
|
122
|
+
my_control.command('run', ['calc']) # Execute AutoIt native run command
|
123
|
+
my_control.command('WinWaitActive', ['Calculator', nil, 30]) # Execute AutoIt native WinWaitActive
|
124
|
+
my_control.command('ControlClick', key_8) # Execute AutoIt native ControlClick clicking with key_8 variable args
|
125
|
+
my_control.command('WinClose', ['Calculator']) # Close window passing the title
|
126
|
+
```
|
127
|
+
|
128
|
+
See its running on IRB (Interactive Ruby mode):
|
129
|
+
![](https://github.com/rpossan/files/blob/master/autoit/autoit_irb.gif)
|
130
|
+
|
131
|
+
## 3 - Basics - Getting started
|
132
|
+
|
133
|
+
* Install Ruby: Linux is recommended to use http://rvm.io. For Windows use Ruby Installer (Next, next ... Finish): https://rubyinstaller.org/
|
134
|
+
|
135
|
+
* In command line test your environment:
|
136
|
+
```sh
|
137
|
+
$ ruby -v
|
138
|
+
ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]
|
139
|
+
```
|
140
|
+
|
141
|
+
* Install autoit gem or use on a Bundler project (https://bundler.io/):
|
142
|
+
```sh
|
143
|
+
$ gem install autoit
|
144
|
+
Successfully installed autoit-0.2.0
|
145
|
+
Parsing documentation for autoit-0.2.0
|
146
|
+
Done installing documentation for autoit after 1 seconds
|
147
|
+
1 gem installed
|
148
|
+
```
|
24
149
|
|
25
|
-
|
150
|
+
* Start using and implement your project. We recommend to build a project structure using BDD Cucumber (http://cucumber.io)
|
151
|
+
with the gem BDDFire (https://github.com/Shashikant86/bddfire) to have a complete and full of features tool for your
|
152
|
+
automation project focused highly on your business, not just in coding.
|
26
153
|
|
27
|
-
## Development
|
154
|
+
## 4 - Development
|
28
155
|
|
29
156
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
157
|
|
31
158
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
159
|
|
33
|
-
## Contributing
|
160
|
+
## 5 - Contributing
|
34
161
|
|
35
162
|
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/autoit. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
163
|
|
37
|
-
## License
|
164
|
+
## 6 - License
|
38
165
|
|
39
166
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
40
167
|
|
41
|
-
## Code of Conduct
|
168
|
+
## 7 - Code of Conduct
|
42
169
|
|
43
170
|
Everyone interacting in the Autoit project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/autoit/blob/master/CODE_OF_CONDUCT.md).
|
171
|
+
|
172
|
+
|
173
|
+
## 8 - Support
|
174
|
+
You can starting contacting the developer team members or just openning an issue in the project:
|
175
|
+
https://github.com/rpossan/autoit/issues
|
176
|
+
|
177
|
+
For more details, please send me an e-mail. I'll have the pleasure talking to you: ronaldo.possan@gmail.com
|
data/Rakefile
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
3
|
|
4
4
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
7
|
-
t.test_files = FileList[
|
5
|
+
t.libs << 'test'
|
6
|
+
t.libs << 'lib'
|
7
|
+
t.test_files = FileList['test/**/*_test.rb']
|
8
|
+
|
9
|
+
desc 'Run Rubocop analysis and open in the browser'
|
10
|
+
task :rubocop do
|
11
|
+
system "rubocop -f html -o rubocop.html -c rubocop.yml &\
|
12
|
+
start chrome rubocop.html"
|
13
|
+
end
|
8
14
|
end
|
9
15
|
|
10
|
-
task :
|
16
|
+
task default: :test
|
data/autoit.gemspec
CHANGED
@@ -1,20 +1,35 @@
|
|
1
|
-
|
2
1
|
lib = File.expand_path("../lib", __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require "autoit/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
4
|
+
Gem::Specification.new do |spec|
|
7
5
|
spec.name = "autoit"
|
8
6
|
spec.version = Autoit::VERSION
|
9
7
|
spec.authors = ["Ronaldo Possan"]
|
10
8
|
spec.email = ["ronaldo.possan@gmail.com"]
|
11
9
|
|
12
|
-
spec.summary =
|
13
|
-
|
10
|
+
spec.summary = <<-EOF
|
11
|
+
AutoIt is a gem to handle and integrate Windows Automation in your project and tests using the AutoIt software and Windows OLE
|
12
|
+
objects. With AutoIt gem you can run easily wrapper methods or run natives AutoIt commands.
|
13
|
+
Enjoy this awesome project together. Use, review, contribute and give us a STAR!
|
14
|
+
EOF
|
15
|
+
|
16
|
+
spec.description = <<-EOF
|
17
|
+
AutoIt is a gem to integrate in your automation project and tests using the AutoIt software for interact with Windows OLE
|
18
|
+
objects. With AutoIt gem you can run the easy wrapper methods or run natives AutoIt commands.
|
19
|
+
|
20
|
+
We are building a new concept to match Windows elements called WPath. Yes, this is similar to the known XPath and we are
|
21
|
+
trying to bring this feature to easily find elements on the screen. For example: `//Calculator/Button[@id=135]` will match an
|
22
|
+
element on the screen with title "Calculator", with class Button and ID 135.
|
23
|
+
|
24
|
+
We recommend to build a project structure using BDD Cucumber (http://cucumber.io) with the gem BDDFire (https://github.com/Shashikant86/bddfire)
|
25
|
+
to have a complete and full of features tool for your automation project focused highly on your business, not just in code.
|
26
|
+
|
27
|
+
Enjoy this awesome project together. Use, review, contribute and give us a STAR!
|
28
|
+
EOF
|
29
|
+
|
14
30
|
spec.homepage = "https://github.com/rpossan/autoit"
|
15
31
|
spec.license = "MIT"
|
16
|
-
|
17
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
32
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
33
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
34
|
if spec.respond_to?(:metadata)
|
20
35
|
#spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
@@ -25,21 +40,18 @@ Gem::Specification.new do |spec|
|
|
25
40
|
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
41
|
"public gem pushes."
|
27
42
|
end
|
28
|
-
|
29
|
-
# Specify which files should be added to the gem when it is released.
|
43
|
+
# Specify which files should be added to the gem when it is released.
|
30
44
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
31
45
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
32
46
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
47
|
end
|
34
|
-
spec.bindir = "
|
35
|
-
spec.executables
|
48
|
+
spec.bindir = "bin"
|
49
|
+
spec.executables << "autoit"
|
36
50
|
spec.require_paths = ["lib"]
|
37
|
-
|
38
|
-
spec.add_dependency "thor"
|
39
|
-
|
51
|
+
spec.add_dependency "os"
|
40
52
|
spec.add_development_dependency "bundler", "~> 1.16"
|
41
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
42
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
43
|
-
spec.add_development_dependency "rubocop", "~> 0.49.0"
|
44
53
|
spec.add_development_dependency "byebug", "~> 10.0"
|
54
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
55
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
56
|
+
spec.add_development_dependency "rubocop", ">= 0.49.0"
|
45
57
|
end
|
data/bin/autoit
CHANGED
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'autoit'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
8
8
|
|
9
9
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require
|
10
|
+
# require 'pry'
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start(__FILE__)
|
data/lib/autoit.rb
CHANGED
data/lib/autoit/control.rb
CHANGED
@@ -1,35 +1,53 @@
|
|
1
|
-
#require 'Win32API'
|
1
|
+
# require 'Win32API'
|
2
2
|
require 'win32ole'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
4
|
+
module AutoIt
|
5
|
+
# Class module to execute control commands on AutoIt DLL. Its possible
|
6
|
+
# to run native commands and some methods for object
|
7
|
+
class Control
|
8
|
+
attr_reader :win
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@win = WIN32OLE.new('AutoItX3.Control')
|
12
|
+
end
|
13
|
+
|
14
|
+
def command(cmd, args = {})
|
15
|
+
execute { win.send(cmd, *args) }
|
16
|
+
end
|
17
|
+
|
18
|
+
def win_close(title)
|
19
|
+
execute { win.WinClose title }
|
20
|
+
end
|
21
|
+
|
22
|
+
def open_app(app)
|
23
|
+
execute { win.run app }
|
24
|
+
end
|
25
|
+
|
26
|
+
def click_on(title, id, text = nil)
|
27
|
+
execute do
|
28
|
+
win.WinWaitActive(title, nil, 30)
|
29
|
+
win.ControlClick(title, text, id)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def get_text(title)
|
34
|
+
win.WinGetText(title)
|
35
|
+
end
|
36
|
+
|
37
|
+
def has_int?(title, value)
|
38
|
+
found = get_text title
|
39
|
+
found.to_i == value
|
40
|
+
end
|
41
|
+
|
42
|
+
def has_text?(title, text)
|
43
|
+
found = get_text title
|
44
|
+
found.to_s.chomp == text.to_s
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def execute
|
50
|
+
yield > 0
|
51
|
+
end
|
27
52
|
end
|
28
|
-
|
29
|
-
def has_text?(title, text, get_int=false)
|
30
|
-
found = get_text title
|
31
|
-
found = text.to_i.to_s if get_int
|
32
|
-
found == text
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
53
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require 'byebug'
|
3
|
+
require 'os'
|
4
|
+
|
5
|
+
# Not implemented yet
|
6
|
+
module Autoit
|
7
|
+
# Module to supports CLI commands
|
8
|
+
class Install < Thor
|
9
|
+
desc 'install', 'Install AutoIt DLLs to run properly.'
|
10
|
+
long_desc <<-D
|
11
|
+
'install' Install specific AutoIt DLL on your operation system (X86 or 64 bits version).
|
12
|
+
D
|
13
|
+
option :format
|
14
|
+
def install
|
15
|
+
system "vendor\\register#{OS.bits}.bat"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/autoit/version.rb
CHANGED
data/rubocop.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
@echo off
|
3
|
+
|
4
|
+
:: BatchGotAdmin
|
5
|
+
:-------------------------------------
|
6
|
+
REM --> Check for permissions
|
7
|
+
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
|
8
|
+
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
|
9
|
+
) ELSE (
|
10
|
+
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
11
|
+
)
|
12
|
+
|
13
|
+
REM --> If error flag set, we do not have admin.
|
14
|
+
if '%errorlevel%' NEQ '0' (
|
15
|
+
echo Requesting administrative privileges...
|
16
|
+
goto UACPrompt
|
17
|
+
) else ( goto gotAdmin )
|
18
|
+
|
19
|
+
:UACPrompt
|
20
|
+
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
|
21
|
+
set params= %*
|
22
|
+
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
|
23
|
+
|
24
|
+
"%temp%\getadmin.vbs"
|
25
|
+
del "%temp%\getadmin.vbs"
|
26
|
+
exit /B
|
27
|
+
|
28
|
+
:gotAdmin
|
29
|
+
pushd "%CD%"
|
30
|
+
CD /D "%~dp0"
|
31
|
+
:--------------------------------------
|
32
|
+
regsvr32.exe %~dp0AutoItX3.dll
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
@echo off
|
3
|
+
|
4
|
+
:: BatchGotAdmin
|
5
|
+
:-------------------------------------
|
6
|
+
REM --> Check for permissions
|
7
|
+
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
|
8
|
+
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
|
9
|
+
) ELSE (
|
10
|
+
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
|
11
|
+
)
|
12
|
+
|
13
|
+
REM --> If error flag set, we do not have admin.
|
14
|
+
if '%errorlevel%' NEQ '0' (
|
15
|
+
echo Requesting administrative privileges...
|
16
|
+
goto UACPrompt
|
17
|
+
) else ( goto gotAdmin )
|
18
|
+
|
19
|
+
:UACPrompt
|
20
|
+
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
|
21
|
+
set params= %*
|
22
|
+
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
|
23
|
+
|
24
|
+
"%temp%\getadmin.vbs"
|
25
|
+
del "%temp%\getadmin.vbs"
|
26
|
+
exit /B
|
27
|
+
|
28
|
+
:gotAdmin
|
29
|
+
pushd "%CD%"
|
30
|
+
CD /D "%~dp0"
|
31
|
+
:--------------------------------------
|
32
|
+
regsvr32.exe %~dp0AutoItX3_x64.dll
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronaldo Possan
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: os
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.16'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: byebug
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
@@ -67,42 +67,52 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '5.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: '10.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: '10.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rubocop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 0.49.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
97
|
-
description:
|
98
|
-
|
96
|
+
version: 0.49.0
|
97
|
+
description: |
|
98
|
+
AutoIt is a gem to integrate in your automation project and tests using the AutoIt software for interact with Windows OLE
|
99
|
+
objects. With AutoIt gem you can run the easy wrapper methods or run natives AutoIt commands.
|
100
|
+
|
101
|
+
We are building a new concept to match Windows elements called WPath. Yes, this is similar to the known XPath and we are
|
102
|
+
trying to bring this feature to easily find elements on the screen. For example: `//Calculator/Button[@id=135]` will match an
|
103
|
+
element on the screen with title "Calculator", with class Button and ID 135.
|
104
|
+
|
105
|
+
We recommend to build a project structure using BDD Cucumber (http://cucumber.io) with the gem BDDFire (https://github.com/Shashikant86/bddfire)
|
106
|
+
to have a complete and full of features tool for your automation project focused highly on your business, not just in code.
|
107
|
+
|
108
|
+
Enjoy this awesome project together. Use, review, contribute and give us a STAR!
|
99
109
|
email:
|
100
110
|
- ronaldo.possan@gmail.com
|
101
|
-
executables:
|
111
|
+
executables:
|
112
|
+
- autoit
|
102
113
|
extensions: []
|
103
114
|
extra_rdoc_files: []
|
104
115
|
files:
|
105
|
-
- ".byebug_history"
|
106
116
|
- ".gitignore"
|
107
117
|
- ".travis.yml"
|
108
118
|
- CHANGELOG.MD
|
@@ -118,12 +128,14 @@ files:
|
|
118
128
|
- bin/console
|
119
129
|
- bin/setup
|
120
130
|
- lib/autoit.rb
|
121
|
-
- lib/autoit/cli.rb
|
122
131
|
- lib/autoit/control.rb
|
132
|
+
- lib/autoit/install.rb
|
123
133
|
- lib/autoit/version.rb
|
134
|
+
- rubocop.yml
|
124
135
|
- vendor/AutoItX3.dll
|
125
136
|
- vendor/AutoItX3_x64.dll
|
126
|
-
- vendor/
|
137
|
+
- vendor/register32.bat
|
138
|
+
- vendor/register64.bat
|
127
139
|
homepage: https://github.com/rpossan/autoit
|
128
140
|
licenses:
|
129
141
|
- MIT
|
@@ -150,5 +162,8 @@ rubyforge_project:
|
|
150
162
|
rubygems_version: 2.6.12
|
151
163
|
signing_key:
|
152
164
|
specification_version: 4
|
153
|
-
summary:
|
165
|
+
summary: AutoIt is a gem to handle and integrate Windows Automation in your project
|
166
|
+
and tests using the AutoIt software and Windows OLE objects. With AutoIt gem you
|
167
|
+
can run easily wrapper methods or run natives AutoIt commands. Enjoy this awesome
|
168
|
+
project together. Use, review, contribute and give us a STAR!
|
154
169
|
test_files: []
|
data/.byebug_history
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
q
|
2
|
-
text
|
3
|
-
found
|
4
|
-
quit
|
5
|
-
win.WinGetText(title)
|
6
|
-
win.ControlGetText(title)
|
7
|
-
title
|
8
|
-
q
|
9
|
-
win
|
10
|
-
win.methods
|
11
|
-
win.StringInStr(win, text)
|
12
|
-
text
|
13
|
-
win
|
14
|
-
c
|
15
|
-
q
|
16
|
-
c
|
17
|
-
text
|
18
|
-
c
|
19
|
-
win.ControlClick(screen, text, id)
|
20
|
-
quit
|
21
|
-
win.ControlClick(screen, "5", id)
|
22
|
-
win.ControlClick(screen, "5", id, "{SPACE}")
|
23
|
-
win.ControlClick(screen, "7", id, "{SPACE}")
|
24
|
-
win.ControlSend(screen, "7", id, "{SPACE}")
|
25
|
-
win.ControlSend(screen, "7", id, "{CLICK}")
|
26
|
-
win.ControlSend(screen, text, id, "{CLICK}")
|
27
|
-
win.ControlSend(screen, text, id, "{SPACE}")
|
28
|
-
win.ControlSend("Calcu")
|
29
|
-
id
|
30
|
-
text
|
31
|
-
screen
|
32
|
-
win.ControlSend(screen, text, id)
|
33
|
-
q
|
34
|
-
win.ControlSend(screen, text, id)
|
35
|
-
"Calculator", "5", "[ID:135]"
|
36
|
-
id
|
37
|
-
text
|
38
|
-
screen
|
39
|
-
c
|
data/lib/autoit/cli.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
|
3
|
-
module Autoit
|
4
|
-
# Module to supports CLI commands
|
5
|
-
class CLI < Thor
|
6
|
-
|
7
|
-
desc "install INPUT", "Install Platform"
|
8
|
-
long_desc <<-D
|
9
|
-
'install INPUT' Install platform on Windows.
|
10
|
-
D
|
11
|
-
option :format
|
12
|
-
def install(input)
|
13
|
-
system "vendor/register.bat"
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
data/vendor/register.bat
DELETED