auto_click 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,5 +2,5 @@ pkg/*
2
2
  *.gem
3
3
  .bundle
4
4
  test_build.rb
5
- test_build.rb
6
- test_run.rb
5
+ test_run.rb
6
+ .project
data/CHANGELOG CHANGED
@@ -1,3 +1,13 @@
1
+ 0.1.3
2
+ More description
3
+
4
+ 0.1.2
5
+ Primitive implementation of mouse_move_percentage_absolute_real, mouse_move_percentage_absolute_virtual, mouse_move_percentage_relative_real, mouse_move_percentage_relative_virtual.
6
+ (Need better consolidation before putting them to the method list)
7
+
8
+ 0.1.1
9
+ Specify required ruby environments
10
+
1
11
  0.1.0
2
12
  rewrite the program using dl instead of Win32API
3
13
 
data/Gemfile.lock ADDED
@@ -0,0 +1,14 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ auto_click (0.1.0)
5
+
6
+ GEM
7
+ remote: http://rubygems.org/
8
+ specs:
9
+
10
+ PLATFORMS
11
+ x86-mingw32
12
+
13
+ DEPENDENCIES
14
+ auto_click!
data/README.rdoc CHANGED
@@ -1,7 +1,14 @@
1
- = auto_click
1
+ = AutoClick
2
2
 
3
3
  Ruby gem for simulating mouse clicks and mouse cursor movement.
4
4
 
5
+ == Description
6
+
7
+ Provide several Ruby methods for simulating mouse click and cursor movement in Windows.
8
+ This gem use DL library and SendInput method so there is no dependency on FFI or Win32-api.
9
+ Currently only contains 5 methods (mouse_move(x,y), left_click, right_click, cursor_position and mouse_scroll).
10
+ More control over mouse movement such as speed or locus will be implemented in future releases.
11
+
5
12
  == Install
6
13
 
7
14
  To install auto_click:
@@ -20,19 +27,59 @@ To move the mouse cursor to 50,50 ( the top left corner is 0,0) and perform a do
20
27
  left_click
21
28
  left_click
22
29
 
23
- To get the current cursor position:
30
+ To show the current cursor position:
24
31
 
25
- cursor_position
32
+ puts cursor_position
26
33
 
27
- To scroll up 10 wheel steps
34
+ To scroll up (forward) 10 wheel steps
28
35
 
29
36
  mouse_scroll(10)
30
37
 
31
- To scroll down 5 wheel steps
38
+ To scroll down (backward) 5 wheel steps
32
39
 
33
40
  mouse_scroll(-5)
34
41
 
42
+
43
+ == Method List
44
+
45
+ - left_click
46
+
47
+ - right_click
48
+
49
+ - cursor_position
50
+
51
+ - mouse_move(x,y)
52
+
53
+ - mouse_scroll(d)
54
+
55
+ == Tested with
56
+
57
+ - Ruby 1.9.1-p430, Windows 7
58
+
59
+ - Ruby 1.9.2-p0, Windows 7
60
+
61
+ - Ruby 1.9.2-p136, Windows 7
35
62
 
36
63
  == License
37
64
 
65
+ MIT license
66
+
67
+ Copyright (C) 2010 by Tom Lam
68
+
69
+ Permission is hereby granted, free of charge, to any person obtaining a copy
70
+ of this software and associated documentation files (the "Software"), to deal
71
+ in the Software without restriction, including without limitation the rights
72
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
73
+ copies of the Software, and to permit persons to whom the Software is
74
+ furnished to do so, subject to the following conditions:
75
+
76
+ The above copyright notice and this permission notice shall be included in
77
+ all copies or substantial portions of the Software.
38
78
 
79
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
80
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
81
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
82
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
83
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
84
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
85
+ THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,2 +1,3 @@
1
+ #$:.unshift( File.dirname(__FILE__) )
1
2
  require 'bundler'
2
- Bundler::GemHelper.install_tasks
3
+ Bundler::GemHelper.install_tasks #:name => 'auto_click'
data/auto_click.gemspec CHANGED
@@ -9,9 +9,13 @@ Gem::Specification.new do |s|
9
9
  s.authors = ["erinata"]
10
10
  s.email = ["erinata@gmail.com"]
11
11
  s.homepage = ""
12
- s.summary = %q{Smulating mouse click and cursor movement in Ruby}
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
-
12
+ s.summary = %q{Smulating mouse click and cursor movement}
13
+ s.description = %q{Provide several Ruby methods for simulating mouse click and cursor movement in Windows.
14
+ This gem use DL library and SendInput method so there is no dependency on FFI or Win32-api.
15
+ Currently only contains 5 methods (mouse_move(x,y), left_click, right_click, cursor_position and mouse_scroll).
16
+ More control over mouse movement such as speed or locus will be implemented in future releases.}
17
+
18
+ s.required_ruby_version = '>= 1.9.0'
15
19
 
16
20
  s.files = `git ls-files`.split("\n")
17
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/lib/auto_click.rb CHANGED
@@ -8,7 +8,7 @@ module AutoClick
8
8
  @@rightup = InputStructure.mouse_input(0,0,0,0x0010)
9
9
  @@leftdown = InputStructure.mouse_input(0,0,0,0x0002)
10
10
  @@leftup = InputStructure.mouse_input(0,0,0,0x0004)
11
-
11
+
12
12
  def send_input(inputs)
13
13
  n = inputs.size
14
14
  ptr = inputs.collect {|i| i.to_s}.join
@@ -19,6 +19,30 @@ module AutoClick
19
19
  User32.SetCursorPos(x,y)
20
20
  end
21
21
 
22
+ def mouse_move_pixel_absolute(x,y)
23
+ User32.SetCursorPos(x,y)
24
+ end
25
+
26
+ def mouse_move_percentage_relative_virtual(x,y) # broken
27
+ move = InputStructure.mouse_input(x,y,0,0x0001)
28
+ send_input( [move])
29
+ end
30
+
31
+ def mouse_move_percentage_relative_real(x,y) # broken
32
+ move = InputStructure.mouse_input(x,y,0,0x4001)
33
+ send_input( [move])
34
+ end
35
+
36
+ def mouse_move_percentage_absolute_virtual(x,y)
37
+ move = InputStructure.mouse_input(x*65536,y*65536,0,0xc001)
38
+ send_input( [move])
39
+ end
40
+
41
+ def mouse_move_percentage_absolute_real(x,y)
42
+ move = InputStructure.mouse_input(x*65536,y*65536,0,0x8001)
43
+ send_input( [move])
44
+ end
45
+
22
46
  def right_click
23
47
  send_input( [@@rightdown, @@rightup] )
24
48
  end
@@ -1,3 +1,3 @@
1
1
  module AutoClick
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 3
9
+ version: 0.1.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - erinata
@@ -14,11 +14,15 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-26 00:00:00 -06:00
17
+ date: 2010-12-30 00:00:00 -06:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
21
- description: 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).
21
+ description: |-
22
+ Provide several Ruby methods for simulating mouse click and cursor movement in Windows.
23
+ This gem use DL library and SendInput method so there is no dependency on FFI or Win32-api.
24
+ Currently only contains 5 methods (mouse_move(x,y), left_click, right_click, cursor_position and mouse_scroll).
25
+ More control over mouse movement such as speed or locus will be implemented in future releases.
22
26
  email:
23
27
  - erinata@gmail.com
24
28
  executables: []
@@ -29,9 +33,9 @@ extra_rdoc_files: []
29
33
 
30
34
  files:
31
35
  - .gitignore
32
- - .project
33
36
  - CHANGELOG
34
37
  - Gemfile
38
+ - Gemfile.lock
35
39
  - README.rdoc
36
40
  - Rakefile
37
41
  - auto_click.gemspec
@@ -54,8 +58,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
58
  - - ">="
55
59
  - !ruby/object:Gem::Version
56
60
  segments:
61
+ - 1
62
+ - 9
57
63
  - 0
58
- version: "0"
64
+ version: 1.9.0
59
65
  required_rubygems_version: !ruby/object:Gem::Requirement
60
66
  none: false
61
67
  requirements:
@@ -70,6 +76,6 @@ rubyforge_project:
70
76
  rubygems_version: 1.3.7
71
77
  signing_key:
72
78
  specification_version: 3
73
- summary: Smulating mouse click and cursor movement in Ruby
79
+ summary: Smulating mouse click and cursor movement
74
80
  test_files: []
75
81
 
data/.project DELETED
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <projectDescription>
3
- <name>auto_click</name>
4
- <comment></comment>
5
- <projects>
6
- </projects>
7
- <buildSpec>
8
- </buildSpec>
9
- <natures>
10
- <nature>com.aptana.ruby.core.rubynature</nature>
11
- </natures>
12
- </projectDescription>