auto_click 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/auto_click.gemspec +0 -1
- data/lib/auto_click.rb +6 -14
- data/lib/auto_click/input_structure.rb +2 -0
- data/lib/auto_click/user32.rb +7 -0
- data/lib/auto_click/version.rb +1 -1
- metadata +3 -3
- data/lib/auto_click/tools.rb +0 -5
data/CHANGELOG
CHANGED
data/auto_click.gemspec
CHANGED
@@ -12,7 +12,6 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{Smulating mouse click and cursor movement in Ruby}
|
13
13
|
s.description = %q{Provide several ruby methods for simulating mouse click and cursor movement in Windows. Currently only contains 5 methods (mouse_move(x,y), left_click, right_click, cursor_position and mouse_scroll).}
|
14
14
|
|
15
|
-
# s.rubyforge_project = "auto_click"
|
16
15
|
|
17
16
|
s.files = `git ls-files`.split("\n")
|
18
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
data/lib/auto_click.rb
CHANGED
@@ -1,29 +1,22 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require '
|
4
|
-
|
5
|
-
require "auto_click/input_structure"
|
1
|
+
require 'dl/import'
|
2
|
+
require 'auto_click/input_structure'
|
3
|
+
require 'auto_click/user32'
|
6
4
|
|
7
5
|
module AutoClick
|
8
6
|
|
9
|
-
@@gcp = Win32API.new("user32", "GetCursorPos",'P','V')
|
10
|
-
@@scp = Win32API.new("user32", 'SetCursorPos', 'II', 'V')
|
11
|
-
@@si = Win32API.new("user32", 'SendInput','IPI', 'I')
|
12
|
-
|
13
7
|
@@rightdown = InputStructure.mouse_input(0,0,0,0x0008)
|
14
8
|
@@rightup = InputStructure.mouse_input(0,0,0,0x0010)
|
15
9
|
@@leftdown = InputStructure.mouse_input(0,0,0,0x0002)
|
16
10
|
@@leftup = InputStructure.mouse_input(0,0,0,0x0004)
|
17
11
|
|
18
|
-
|
19
12
|
def send_input(inputs)
|
20
13
|
n = inputs.size
|
21
14
|
ptr = inputs.collect {|i| i.to_s}.join
|
22
|
-
|
15
|
+
User32.SendInput(n, ptr, inputs[0].size)
|
23
16
|
end
|
24
17
|
|
25
18
|
def mouse_move(x,y)
|
26
|
-
|
19
|
+
User32.SetCursorPos(x,y)
|
27
20
|
end
|
28
21
|
|
29
22
|
def right_click
|
@@ -36,7 +29,7 @@ module AutoClick
|
|
36
29
|
|
37
30
|
def cursor_position
|
38
31
|
point = " " * 8
|
39
|
-
|
32
|
+
User32.GetCursorPos(point)
|
40
33
|
point.unpack('LL')
|
41
34
|
end
|
42
35
|
|
@@ -45,7 +38,6 @@ module AutoClick
|
|
45
38
|
send_input( [scroll])
|
46
39
|
end
|
47
40
|
|
48
|
-
|
49
41
|
end
|
50
42
|
|
51
43
|
|
data/lib/auto_click/version.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.5
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- erinata
|
@@ -37,7 +37,7 @@ files:
|
|
37
37
|
- auto_click.gemspec
|
38
38
|
- lib/auto_click.rb
|
39
39
|
- lib/auto_click/input_structure.rb
|
40
|
-
- lib/auto_click/
|
40
|
+
- lib/auto_click/user32.rb
|
41
41
|
- lib/auto_click/version.rb
|
42
42
|
has_rdoc: true
|
43
43
|
homepage: ""
|