autoit 1.1.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +10 -10
- data/CHANGELOG.MD +15 -15
- data/Gemfile +6 -6
- data/Gemfile.lock +43 -43
- data/LICENSE +21 -21
- data/README.md +176 -176
- data/Rakefile +16 -16
- data/_config.yml +1 -0
- data/autoit.gemspec +41 -41
- data/bin/autoit +5 -5
- data/bin/console +14 -14
- data/lib/autoit.rb +6 -6
- data/lib/autoit/control.rb +54 -53
- data/lib/autoit/install.rb +18 -18
- data/lib/autoit/version.rb +3 -3
- data/rubocop.yml +2 -2
- data/vendor/register32.bat +32 -32
- data/vendor/register64.bat +32 -32
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8fc059b77cc8323c9b8aa6748736885f92848edee4c5f3dbfd3295ceb82aadcc
|
4
|
+
data.tar.gz: 485d622411ba4cd04f7aa4969fad55e0b8bf874ed4a2386ba7ce90a83acab9c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4f0ab3685323c918b7aa7f3a188fa2d9895c96bde1896d8098888bef77c8dbb0f5448426d5297666365e1123903aa7e31c620470527a1edf0637a4df455d256
|
7
|
+
data.tar.gz: f6729518b291fddcbd81470194f6e14fcf189467e5d70a67498fa747370a1451d5f6b9543c27f26e4fd4b47742d4441447152ca1057a913627e028a30d714cc7
|
data/.gitignore
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/_yardoc/
|
4
|
-
/coverage/
|
5
|
-
/doc/
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/tmp/
|
9
|
-
/rubocop.html
|
10
|
-
/.byebug_history
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
/rubocop.html
|
10
|
+
/.byebug_history
|
data/CHANGELOG.MD
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
## 1.0.0 (2018-11-09)
|
2
|
-
|
3
|
-
Changes:
|
4
|
-
|
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
|
9
|
-
|
10
|
-
Bugfixes:
|
11
|
-
|
12
|
-
- Nothing
|
13
|
-
|
14
|
-
Documentation:
|
15
|
-
|
1
|
+
## 1.0.0 (2018-11-09)
|
2
|
+
|
3
|
+
Changes:
|
4
|
+
|
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
|
9
|
+
|
10
|
+
Bugfixes:
|
11
|
+
|
12
|
+
- Nothing
|
13
|
+
|
14
|
+
Documentation:
|
15
|
+
|
16
16
|
- Created a complete version of README file
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
|
-
|
5
|
-
# Specify your gem's dependencies in autoit.gemspec
|
6
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in autoit.gemspec
|
6
|
+
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,43 +1,43 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
autoit (0.2.0)
|
5
|
-
os
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
ast (2.4.0)
|
11
|
-
byebug (10.0.2)
|
12
|
-
minitest (5.11.3)
|
13
|
-
os (1.0.0)
|
14
|
-
parallel (1.12.1)
|
15
|
-
parser (2.5.3.0)
|
16
|
-
ast (~> 2.4.0)
|
17
|
-
powerpack (0.1.2)
|
18
|
-
rainbow (2.2.2)
|
19
|
-
rake
|
20
|
-
rake (10.5.0)
|
21
|
-
rubocop (0.49.1)
|
22
|
-
parallel (~> 1.10)
|
23
|
-
parser (>= 2.3.3.1, < 3.0)
|
24
|
-
powerpack (~> 0.1)
|
25
|
-
rainbow (>= 1.99.1, < 3.0)
|
26
|
-
ruby-progressbar (~> 1.7)
|
27
|
-
unicode-display_width (~> 1.0, >= 1.0.1)
|
28
|
-
ruby-progressbar (1.10.0)
|
29
|
-
unicode-display_width (1.4.0)
|
30
|
-
|
31
|
-
PLATFORMS
|
32
|
-
x64-mingw32
|
33
|
-
|
34
|
-
DEPENDENCIES
|
35
|
-
autoit!
|
36
|
-
bundler (~> 1.16)
|
37
|
-
byebug (~> 10.0)
|
38
|
-
minitest (~> 5.0)
|
39
|
-
rake (~> 10.0)
|
40
|
-
rubocop (>= 0.49.0)
|
41
|
-
|
42
|
-
BUNDLED WITH
|
43
|
-
1.16.6
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
autoit (0.2.0)
|
5
|
+
os
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
byebug (10.0.2)
|
12
|
+
minitest (5.11.3)
|
13
|
+
os (1.0.0)
|
14
|
+
parallel (1.12.1)
|
15
|
+
parser (2.5.3.0)
|
16
|
+
ast (~> 2.4.0)
|
17
|
+
powerpack (0.1.2)
|
18
|
+
rainbow (2.2.2)
|
19
|
+
rake
|
20
|
+
rake (10.5.0)
|
21
|
+
rubocop (0.49.1)
|
22
|
+
parallel (~> 1.10)
|
23
|
+
parser (>= 2.3.3.1, < 3.0)
|
24
|
+
powerpack (~> 0.1)
|
25
|
+
rainbow (>= 1.99.1, < 3.0)
|
26
|
+
ruby-progressbar (~> 1.7)
|
27
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
28
|
+
ruby-progressbar (1.10.0)
|
29
|
+
unicode-display_width (1.4.0)
|
30
|
+
|
31
|
+
PLATFORMS
|
32
|
+
x64-mingw32
|
33
|
+
|
34
|
+
DEPENDENCIES
|
35
|
+
autoit!
|
36
|
+
bundler (~> 1.16)
|
37
|
+
byebug (~> 10.0)
|
38
|
+
minitest (~> 5.0)
|
39
|
+
rake (~> 10.0)
|
40
|
+
rubocop (>= 0.49.0)
|
41
|
+
|
42
|
+
BUNDLED WITH
|
43
|
+
1.16.6
|
data/LICENSE
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
MIT License
|
2
|
-
|
3
|
-
Copyright (c) 2018 Ronaldo Possan
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
13
|
-
copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
-
SOFTWARE.
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 Ronaldo Possan
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
CHANGED
@@ -1,177 +1,177 @@
|
|
1
|
-
![AutoIt Logo](https://www.autoitscript.com/images/logo_autoit_210x72@2x.png "AutoIt Logo")Ruby Version
|
2
|
-
|
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.
|
6
|
-
|
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.
|
10
|
-
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
control.command('
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
#
|
88
|
-
control.
|
89
|
-
|
90
|
-
#
|
91
|
-
control.
|
92
|
-
|
93
|
-
|
94
|
-
control.click_on('
|
95
|
-
|
96
|
-
|
97
|
-
control.
|
98
|
-
|
99
|
-
# Check if it has a given
|
100
|
-
control.has_int?('Calculator',
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
```
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
my_control
|
109
|
-
my_control.click_on('Calculator', '[ID:
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
```
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
my_control
|
124
|
-
|
125
|
-
my_control.command('
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
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
|
-
```
|
149
|
-
|
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.
|
153
|
-
|
154
|
-
## 4 - Development
|
155
|
-
|
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.
|
157
|
-
|
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).
|
159
|
-
|
160
|
-
## 5 - Contributing
|
161
|
-
|
162
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
163
|
-
|
164
|
-
## 6 - License
|
165
|
-
|
166
|
-
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
167
|
-
|
168
|
-
## 7 - Code of Conduct
|
169
|
-
|
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/
|
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
|
-
|
1
|
+
![AutoIt Logo](https://www.autoitscript.com/images/logo_autoit_210x72@2x.png "AutoIt Logo")Ruby Version
|
2
|
+
|
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.
|
6
|
+
|
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.
|
10
|
+
|
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
|
+
See its running on IRB (Interactive Ruby mode):
|
16
|
+
![](https://github.com/rpossan/files/blob/master/autoit/autoit_irb.gif)
|
17
|
+
|
18
|
+
1. [Installation](#1---installation)
|
19
|
+
2. [Usage](#2---usage)
|
20
|
+
3. [Basics - Getting started](#3---basics---getting-started)
|
21
|
+
4. [Development](#4---development)
|
22
|
+
5. [Contributing](#5---contributing)
|
23
|
+
6. [License](#6---license)
|
24
|
+
7. [Code of Conduct](#7---code-of-conduct)
|
25
|
+
8. [Support](#8---support)
|
26
|
+
|
27
|
+
## 1 - Installation
|
28
|
+
|
29
|
+
Add this line to your application's Gemfile:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem 'autoit'
|
33
|
+
```
|
34
|
+
|
35
|
+
And then execute:
|
36
|
+
|
37
|
+
$ bundle
|
38
|
+
|
39
|
+
Or install it yourself as:
|
40
|
+
|
41
|
+
$ gem install autoit
|
42
|
+
|
43
|
+
AutoIt Installation:
|
44
|
+
|
45
|
+
AutoIt gem has a executable 'autoit' with the command 'install' to install the AutoIt DLL's for Operating System 32 or 64 bits.
|
46
|
+
|
47
|
+
You can install autoit manually by yourself following the instructions: https://www.autoitscript.com/site/autoit/downloads/
|
48
|
+
|
49
|
+
If you have already installed AutoIt DLLs on your system ignore this step.
|
50
|
+
|
51
|
+
DLLs are located and will be up to date on the folder: https://github.com/rpossan/autoit/tree/master/vendor
|
52
|
+
|
53
|
+
```sh
|
54
|
+
$ autoit install
|
55
|
+
```
|
56
|
+
|
57
|
+
System will ask for Administrator access. Click on "Yes" to register the properly DLL on your system register.
|
58
|
+
|
59
|
+
![](https://github.com/rpossan/files/blob/master/autoit/autoit_install.gif)
|
60
|
+
|
61
|
+
## 2 - Usage
|
62
|
+
|
63
|
+
The basics of usage is very simples.
|
64
|
+
First step you need to instance an object (or call directly) from the class Control of AutoIt module.
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
control = AutoIt::Control.new
|
68
|
+
```
|
69
|
+
|
70
|
+
Once object instanced, you can call the method "command" to run native AutoIt commands exactly how you can see in the
|
71
|
+
AutoIt library documentation: https://www.autoitscript.com/autoit3/docs/functions/.
|
72
|
+
|
73
|
+
First argument of this method is the command that you want to run following of the AutoIt function arguments.
|
74
|
+
|
75
|
+
```ruby
|
76
|
+
control.command('run', ['calc']) # Open the Windows calculator
|
77
|
+
|
78
|
+
# Click on element located by 'Calculator' title, '8' text and ID 138
|
79
|
+
control.command('ControlClick', ['Calculator', '8', '[ID:138]'])
|
80
|
+
```
|
81
|
+
This example of use is exaclty as AutoIt ControlClick funtcion documentation: https://www.autoitscript.com/autoit3/docs/functions/ControlClick.htm
|
82
|
+
|
83
|
+
Using ruby wrapper methods:
|
84
|
+
|
85
|
+
>_This is UNDER construction - Keep your autoit gem up to date to get all features_
|
86
|
+
```ruby
|
87
|
+
# Open app and run executables
|
88
|
+
control.open_app('calc') # open Windows calculator. Can be a executable or path to an .exe file
|
89
|
+
|
90
|
+
# Closing windows
|
91
|
+
control.win_close 'Calculator' # close window with title 'Calculator'
|
92
|
+
|
93
|
+
# Clicking elements
|
94
|
+
control.click_on('Calculator', '[ID:135]', '5') # click on element with window title 'Calculator', ID 135 and text '5'
|
95
|
+
control.click_on('135') # Click on first element found with id 135
|
96
|
+
control.click_on({class: "Button", instance: 9, id: 138, text: "5"}) #Using a hash of arguments
|
97
|
+
control.click_on('//Calculator[@id=135]') # Using WPath - Our innovative way to match elements by paths, similar to XPath for HTML
|
98
|
+
|
99
|
+
# Check if it has a given integer value on the window with title Calculator
|
100
|
+
control.has_int?('Calculator', 10)
|
101
|
+
|
102
|
+
# Check if it has a given text on the window with title Calculator
|
103
|
+
control.has_int?('Calculator', "MC")
|
104
|
+
```
|
105
|
+
|
106
|
+
Example of how to automate the sum using the Windows Calculator with wrapper methods:
|
107
|
+
```ruby
|
108
|
+
my_control = AutoIt::Control.new # instance object
|
109
|
+
my_control.click_on('Calculator', '[ID:135]', '5') # click on '5'
|
110
|
+
my_control.click_on('Calculator', '[ID:93]', '+') # click on '+'
|
111
|
+
my_control.click_on('Calculator', '[ID:135]', '5') # click on '5'
|
112
|
+
my_control.click_on('Calculator', '[ID:121]', '=') # click on '='
|
113
|
+
|
114
|
+
if my_control.has_int?('Calculator', 10)
|
115
|
+
puts "Yes, I see 10 text on the the result element!"
|
116
|
+
end
|
117
|
+
|
118
|
+
my_control.win_close 'Calculator' # Close window with 'Calculator' title
|
119
|
+
```
|
120
|
+
|
121
|
+
Same example but now using native commands of AutoIt DLL:
|
122
|
+
```ruby
|
123
|
+
my_control = AutoIt::Control.new # instance object
|
124
|
+
key_8 = ['Calculator', '8', '[ID:138]'] # An array with options
|
125
|
+
my_control.command('run', ['calc']) # Execute AutoIt native run command
|
126
|
+
my_control.command('WinWaitActive', ['Calculator', nil, 30]) # Execute AutoIt native WinWaitActive
|
127
|
+
my_control.command('ControlClick', key_8) # Execute AutoIt native ControlClick clicking with key_8 variable args
|
128
|
+
my_control.command('WinClose', ['Calculator']) # Close window passing the title
|
129
|
+
```
|
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
|
+
```
|
149
|
+
|
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.
|
153
|
+
|
154
|
+
## 4 - Development
|
155
|
+
|
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.
|
157
|
+
|
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).
|
159
|
+
|
160
|
+
## 5 - Contributing
|
161
|
+
|
162
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rpossan/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.
|
163
|
+
|
164
|
+
## 6 - License
|
165
|
+
|
166
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
167
|
+
|
168
|
+
## 7 - Code of Conduct
|
169
|
+
|
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/rpossan/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
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,16 +1,16 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rake/testtask'
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
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
|
14
|
-
end
|
15
|
-
|
16
|
-
task default: :test
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
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
|
14
|
+
end
|
15
|
+
|
16
|
+
task default: :test
|
data/_config.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
theme: jekyll-theme-midnight
|
data/autoit.gemspec
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
lib = File.expand_path("../lib", __FILE__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require "autoit/version"
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
spec.name = "autoit"
|
6
|
-
spec.version = Autoit::VERSION
|
7
|
-
spec.authors = ["Ronaldo Possan"]
|
8
|
-
spec.email = ["ronaldo.possan@gmail.com"]
|
9
|
-
spec.summary = "A ruby gem to handle Windows objects with AutoIT for Automation and Tests projects."
|
10
|
-
spec.description = <<-EOF
|
11
|
-
AutoIt is a gem to integrate in your automation project and tests using the AutoIt software for interact with Windows OLE
|
12
|
-
bjects. With AutoIt gem you can run the easy wrapper methods or run natives AutoIt commands.
|
13
|
-
EOF
|
14
|
-
spec.homepage = "https://github.com/rpossan/autoit"
|
15
|
-
spec.license = "MIT"
|
16
|
-
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
-
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
-
if spec.respond_to?(:metadata)
|
19
|
-
#spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
-
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
-
spec.metadata["source_code_uri"] = "https://github.com/rpossan/autoit"
|
22
|
-
spec.metadata["changelog_uri"] = "https://github.com/rpossan/autoit/blob/master/CHANGELOG.md"
|
23
|
-
else
|
24
|
-
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
-
"public gem pushes."
|
26
|
-
end
|
27
|
-
# Specify which files should be added to the gem when it is released.
|
28
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
-
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
30
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
|
-
end
|
32
|
-
spec.bindir = "bin"
|
33
|
-
spec.executables << "autoit"
|
34
|
-
spec.require_paths = ["lib"]
|
35
|
-
spec.add_dependency "os"
|
36
|
-
spec.add_development_dependency "bundler", "~> 1.16"
|
37
|
-
spec.add_development_dependency "byebug", "~> 10.0"
|
38
|
-
spec.add_development_dependency "minitest", "~> 5.0"
|
39
|
-
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
-
spec.add_development_dependency "rubocop", ">= 0.49.0"
|
41
|
-
end
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "autoit/version"
|
4
|
+
Gem::Specification.new do |spec|
|
5
|
+
spec.name = "autoit"
|
6
|
+
spec.version = Autoit::VERSION
|
7
|
+
spec.authors = ["Ronaldo Possan"]
|
8
|
+
spec.email = ["ronaldo.possan@gmail.com"]
|
9
|
+
spec.summary = "A ruby gem to handle Windows objects with AutoIT for Automation and Tests projects."
|
10
|
+
spec.description = <<-EOF
|
11
|
+
AutoIt is a gem to integrate in your automation project and tests using the AutoIt software for interact with Windows OLE
|
12
|
+
bjects. With AutoIt gem you can run the easy wrapper methods or run natives AutoIt commands.
|
13
|
+
EOF
|
14
|
+
spec.homepage = "https://github.com/rpossan/autoit"
|
15
|
+
spec.license = "MIT"
|
16
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
17
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
18
|
+
if spec.respond_to?(:metadata)
|
19
|
+
#spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
+
spec.metadata["source_code_uri"] = "https://github.com/rpossan/autoit"
|
22
|
+
spec.metadata["changelog_uri"] = "https://github.com/rpossan/autoit/blob/master/CHANGELOG.md"
|
23
|
+
else
|
24
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
25
|
+
"public gem pushes."
|
26
|
+
end
|
27
|
+
# Specify which files should be added to the gem when it is released.
|
28
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
29
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
30
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
31
|
+
end
|
32
|
+
spec.bindir = "bin"
|
33
|
+
spec.executables << "autoit"
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
spec.add_dependency "os"
|
36
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
37
|
+
spec.add_development_dependency "byebug", "~> 10.0"
|
38
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
39
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
40
|
+
spec.add_development_dependency "rubocop", ">= 0.49.0"
|
41
|
+
end
|
data/bin/autoit
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'autoit/install'
|
4
|
-
|
5
|
-
Autoit::Install.start(ARGV)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'autoit/install'
|
4
|
+
|
5
|
+
Autoit::Install.start(ARGV)
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'autoit'
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require 'pry'
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require 'irb'
|
14
|
-
IRB.start(__FILE__)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'autoit'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require 'pry'
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/lib/autoit.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'autoit/version'
|
2
|
-
require 'autoit/control'
|
3
|
-
|
4
|
-
# Main module to load and execute AutoIt commands
|
5
|
-
module AutoIt
|
6
|
-
end
|
1
|
+
require 'autoit/version'
|
2
|
+
require 'autoit/control'
|
3
|
+
|
4
|
+
# Main module to load and execute AutoIt commands
|
5
|
+
module AutoIt
|
6
|
+
end
|
data/lib/autoit/control.rb
CHANGED
@@ -1,53 +1,54 @@
|
|
1
|
-
# require 'Win32API'
|
2
|
-
require 'win32ole'
|
3
|
-
|
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
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
win.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
found
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
found
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
1
|
+
# require 'Win32API'
|
2
|
+
require 'win32ole'
|
3
|
+
|
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
|
+
raise "Parameter: '#{app}' is invalid!" if app.nil? || app.empty?
|
24
|
+
execute { win.run app }
|
25
|
+
end
|
26
|
+
|
27
|
+
def click_on(title, id, text = nil)
|
28
|
+
execute do
|
29
|
+
win.WinWaitActive(title, nil, 30)
|
30
|
+
win.ControlClick(title, text, id)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def get_text(title)
|
35
|
+
win.WinGetText(title)
|
36
|
+
end
|
37
|
+
|
38
|
+
def has_int?(title, value)
|
39
|
+
found = get_text title
|
40
|
+
found.to_i == value
|
41
|
+
end
|
42
|
+
|
43
|
+
def has_text?(title, text)
|
44
|
+
found = get_text title
|
45
|
+
found.to_s.chomp == text.to_s
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def execute
|
51
|
+
yield > 0
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
data/lib/autoit/install.rb
CHANGED
@@ -1,18 +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
|
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
@@ -1,3 +1,3 @@
|
|
1
|
-
module Autoit
|
2
|
-
VERSION = '1.1
|
3
|
-
end
|
1
|
+
module Autoit
|
2
|
+
VERSION = '1.3.1'.freeze
|
3
|
+
end
|
data/rubocop.yml
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
AllCops:
|
2
|
-
Exclude:
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
3
|
- '**/*.gemspec'
|
data/vendor/register32.bat
CHANGED
@@ -1,32 +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
|
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
|
data/vendor/register64.bat
CHANGED
@@ -1,32 +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
|
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,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ronaldo Possan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11
|
11
|
+
date: 2018-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: os
|
@@ -114,6 +114,7 @@ files:
|
|
114
114
|
- LICENSE.txt
|
115
115
|
- README.md
|
116
116
|
- Rakefile
|
117
|
+
- _config.yml
|
117
118
|
- autoit.gemspec
|
118
119
|
- bin/autoit
|
119
120
|
- bin/console
|
@@ -150,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
151
|
version: '0'
|
151
152
|
requirements: []
|
152
153
|
rubyforge_project:
|
153
|
-
rubygems_version: 2.6
|
154
|
+
rubygems_version: 2.7.6
|
154
155
|
signing_key:
|
155
156
|
specification_version: 4
|
156
157
|
summary: A ruby gem to handle Windows objects with AutoIT for Automation and Tests
|