auto_click 0.0.5 → 0.1.0

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/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ 0.1.0
2
+ rewrite the program using dl instead of Win32API
3
+
1
4
  0.0.5
2
5
  remove gem dependency requirement.
3
6
 
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 'Win32API'
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
- @@si.call(n, ptr, inputs[0].size)
15
+ User32.SendInput(n, ptr, inputs[0].size)
23
16
  end
24
17
 
25
18
  def mouse_move(x,y)
26
- @@scp.call(x,y)
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
- @@gcp.call(point)
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
 
@@ -9,4 +9,6 @@ module InputStructure
9
9
  mi[4] = dw_flags
10
10
  mi.pack('LLLLLLL')
11
11
  end
12
+
13
+
12
14
  end
@@ -0,0 +1,7 @@
1
+ module User32
2
+ extend DL::Importer
3
+ dlload 'user32'
4
+ extern "int GetCursorPos(char*)"
5
+ extern "int SetCursorPos(int,int)"
6
+ extern "int SendInput(int,char*,int)"
7
+ end
@@ -1,3 +1,3 @@
1
1
  module AutoClick
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
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
- - 5
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/tools.rb
40
+ - lib/auto_click/user32.rb
41
41
  - lib/auto_click/version.rb
42
42
  has_rdoc: true
43
43
  homepage: ""
@@ -1,5 +0,0 @@
1
- module Tools
2
- def self.call_name
3
- 'Someone'
4
- end
5
- end