auto_click 0.5.0 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8a59692f222289e432f4ccf0371268caf610f529e6d15ace1379645656fb628
4
- data.tar.gz: ee40eee7a6aee940640188e7afef2bbae82278d17a1498e84e83f552816a69eb
3
+ metadata.gz: b9831eafa83d7f3e0f917a8633cf7abdb2faf15a8e7c0ece291c9055137b9c64
4
+ data.tar.gz: d101fce7b1edea88de2569a3f3b1aac994b3472fce44f9b8541770dbec95bbda
5
5
  SHA512:
6
- metadata.gz: 8fc679de6858520e073e0c3fb1262cac72cd42554532a623fae13f95f7f169c15a0ea5701d76c2700f94fbbfd26f4096f39a86fe23f142e7b82b848522f8ace6
7
- data.tar.gz: 07d34d59901df97034877f68dd136b9a586fbd901aa206e6e8193fa1aadf922febceb39efadd593386b2c9b3345b9248d5c792e4c02ef0e7cb3d6b9fb092ee2d
6
+ metadata.gz: 95d5d86dc6eff08f4102a18ebf9fdf09c277c9d54041805fb1441afbbe16c9af102cc3ff88569b94d0233afab515ace32a4a065ed1b54610a0ec9e6f7162b0e3
7
+ data.tar.gz: '05909ad7bc7872b56abdcfcc0e238f401f52d6da14737c2de6a7d20c8d4f123575183debd44a1fe5589279837158461afd60e49692fccbe5690d53644dedd41d'
data/CHANGELOG CHANGED
@@ -3,6 +3,7 @@
3
3
  0.5.0
4
4
  Add mouse_move_percentage and get_screen_resolution
5
5
  Autoclick will not include the methods automatically
6
+ Users have to explicitly use "include AutoClickMethods" to include the methods
6
7
 
7
8
  0.4.0
8
9
  Fix the 64bit bug and Fixnum! bug
@@ -8,12 +8,16 @@ To install auto_click:
8
8
 
9
9
  gem install auto_click
10
10
 
11
+ To update auto_click:
12
+
13
+ gem update auto_click
14
+
11
15
  == Basic Usage
12
16
 
13
17
  Using auto_click is easy. To use the methods provided by auto_click. You need to require the gem and include the module:
14
18
 
15
19
  require 'auto_click'
16
- Include AutoClickMethods
20
+ include AutoClickMethods
17
21
 
18
22
  To move the mouse cursor to 50,50 ( the top left corner is 0,0) and perform a double left click:
19
23
 
@@ -157,18 +161,18 @@ The list of virtual key codes can be found at http://msdn.microsoft.com/en-us/li
157
161
 
158
162
  There are some methods which are not discussed here. Please see the following Method List for all the available methods.
159
163
 
160
- Finally, if you do not want include the auto_click methods, instead of using
164
+ == Namespace
165
+
166
+ If you do not want include the auto_click methods, instead of using
161
167
 
162
168
  include AutoClickMethods
163
169
 
164
- you can construct a new instance of AutoClick and involve the methods as class methods
170
+ you can construct a new instance of AutoClick and invoke the methods from the instance:
165
171
 
166
172
  ac = AutoClick.new()
167
173
  ac.mouse_move(50,50)
168
174
 
169
175
 
170
-
171
-
172
176
  == Method List
173
177
 
174
178
  - left_click
@@ -205,7 +209,7 @@ you can construct a new instance of AutoClick and involve the methods as class m
205
209
 
206
210
  == To Do List
207
211
 
208
- - Backward compatibility with 32-bit ruby
212
+ - Backward compatibility with 32-bit Ruby
209
213
 
210
214
  - Add options of movement speed of mouse so the cursor is actually "moving" instead of just show up at the destination instantly
211
215
 
@@ -220,7 +224,7 @@ you can construct a new instance of AutoClick and involve the methods as class m
220
224
  == Change log
221
225
  (for full change log please refer to the CHANGELOG file in the repository)
222
226
 
223
- - 0.4.3 Add mouse_move_percentage and get_screen_resolution
227
+ - 0.5.0 Users have to explicitly use "include AutoClickMethods" to include the methods, add mouse_move_percentage and get_screen_resolution
224
228
 
225
229
  - 0.4.0 Fix the 64bit bug and Fixnum! bug
226
230
 
@@ -22,4 +22,5 @@ Gem::Specification.new do |s|
22
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
23
23
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
24
24
  s.require_paths = ["lib"]
25
+ s.licenses = "MIT"
25
26
  end
@@ -31,29 +31,6 @@ module AutoClickMethods
31
31
  User32.SetCursorPos(get_screen_resolution[0]*x,get_screen_resolution[1]*y)
32
32
  end
33
33
 
34
- # def mouse_move_pixel_absolute(x,y)
35
- # User32.SetCursorPos(x,y)
36
- # end
37
-
38
- # def mouse_move_percentage_relative_virtual(x,y) # broken
39
- # move = InputStructure.mouse_input(x,y,0,0x0001)
40
- # send_input( [move])
41
- # end
42
-
43
- # def mouse_move_percentage_relative_real(x,y) # broken
44
- # move = InputStructure.mouse_input(x,y,0,0x4001)
45
- # send_input( [move])
46
- # end
47
-
48
- # def mouse_move_percentage_absolute_virtual(x,y)
49
- # move = InputStructure.mouse_input(x*65536,y*65536,0,0xc001)
50
- # send_input( [move])
51
- # end
52
-
53
- # def mouse_move_percentage_absolute_real(x,y)
54
- # move = InputStructure.mouse_input(x*65536,y*65536,0,0x8001)
55
- # send_input( [move])
56
- # end
57
34
 
58
35
  def right_click
59
36
  send_input( [@@rightdown, @@rightup] )
@@ -93,6 +70,97 @@ module AutoClickMethods
93
70
  left_click
94
71
  left_click
95
72
  end
73
+
74
+ ################# TEMP #####################
75
+
76
+
77
+ @@rightdown32 = InputStructure.mouse_input_32(0,0,0,0x0008)
78
+ @@rightup32 = InputStructure.mouse_input_32(0,0,0,0x0010)
79
+ @@leftdown32 = InputStructure.mouse_input_32(0,0,0,0x0002)
80
+ @@leftup32 = InputStructure.mouse_input_32(0,0,0,0x0004)
81
+ @@middledown32 = InputStructure.mouse_input_32(0,0,0,0x0020)
82
+ @@middleup32 = InputStructure.mouse_input_32(0,0,0,0x0040)
83
+
84
+
85
+ def right_click_32
86
+ send_input( [@@rightdown32, @@rightup32] )
87
+ end
88
+
89
+ def left_click_32
90
+ send_input( [@@leftdown32, @@leftup32] )
91
+ end
92
+
93
+ def middle_click_32
94
+ send_input( [@@middledown32, @@middleup32] )
95
+ end
96
+
97
+ def mouse_down_32(button_name)
98
+ case button_name
99
+ when :right
100
+ send_input( [@@rightdown32] )
101
+ when :middle
102
+ send_input( [@@middledown32] )
103
+ else
104
+ send_input( [@@leftdown32] )
105
+ end
106
+ end
107
+
108
+ def mouse_up_32(button_name)
109
+ case button_name
110
+ when :right
111
+ send_input( [@@rightup32] )
112
+ when :middle
113
+ send_input( [@@middleup32] )
114
+ else
115
+ send_input( [@@leftup32] )
116
+ end
117
+ end
118
+
119
+ def double_click_32
120
+ left_click_32
121
+ left_click_32
122
+ end
123
+
124
+
125
+ def left_drag_32(sx,sy,ex,ey)
126
+ mouse_move sx,sy
127
+ sleep 0.1
128
+ send_input( [@@leftdown32] )
129
+ sleep 0.1
130
+ mouse_move ex,ey
131
+ sleep 0.1
132
+ send_input( [@@leftup32] )
133
+ sleep 0.1
134
+ end
135
+
136
+ def right_drag_32(sx,sy,ex,ey)
137
+ mouse_move sx,sy
138
+ sleep 0.1
139
+ send_input( [@@rightdown32] )
140
+ sleep 0.1
141
+ mouse_move ex,ey
142
+ sleep 0.1
143
+ send_input( [@@rightup32] )
144
+ sleep 0.1
145
+ end
146
+
147
+ def key_stroke_32(key_name)
148
+ code=VirtualKey.code_from_name(key_name)
149
+ send_input([InputStructure.keyboard_input_32(code,0x0000),
150
+ InputStructure.keyboard_input_32(code,0x0002)])
151
+ end
152
+
153
+ def key_down_32(key_name)
154
+ code=VirtualKey.code_from_name(key_name)
155
+ send_input([InputStructure.keyboard_input_32(code,0x0000)])
156
+ end
157
+
158
+ def key_up_32(key_name)
159
+ code=VirtualKey.code_from_name(key_name)
160
+ send_input([InputStructure.keyboard_input_32(code,0x0002)])
161
+ end
162
+
163
+ ################# END TEMP #####################
96
164
 
97
165
  def cursor_position
98
166
  point = " " * 8
@@ -17,5 +17,24 @@ module InputStructure
17
17
  ki[2] = dw_flags
18
18
  ki.pack('QLLLLQQ')
19
19
  end
20
+
21
+ def self.mouse_input_32(dx,dy,mouse_data,dw_flags)
22
+ mi = Array.new(7, 0)
23
+ mi[0] = 0
24
+ mi[1] = dx
25
+ mi[2] = dy
26
+ mi[3] = mouse_data
27
+ mi[4] = dw_flags
28
+ mi.pack('LLLLLLL')
29
+ end
30
+
31
+ def self.keyboard_input_32(wVk,dw_flags)
32
+ ki = Array.new(7, 0)
33
+ ki[0] = 1
34
+ ki[1] = wVk
35
+ ki[2] = dw_flags
36
+ ki.pack('LLLLLLL')
37
+ end
38
+
20
39
 
21
40
  end
@@ -1,3 +1,3 @@
1
1
  module AutoClick
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auto_click
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - erinata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2019-05-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: "Provide several Ruby methods for simulating mouse click, cursor movement
14
14
  and keystrokes in Windows. \n This gem use DL library and SendInput
@@ -36,7 +36,8 @@ files:
36
36
  - lib/auto_click/version.rb
37
37
  - lib/auto_click/virtual_key.rb
38
38
  homepage: https://github.com/erinata/auto_click
39
- licenses: []
39
+ licenses:
40
+ - MIT
40
41
  metadata: {}
41
42
  post_install_message:
42
43
  rdoc_options: []
@@ -53,7 +54,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
54
  - !ruby/object:Gem::Version
54
55
  version: '0'
55
56
  requirements: []
56
- rubygems_version: 3.0.3
57
+ rubyforge_project:
58
+ rubygems_version: 2.7.7
57
59
  signing_key:
58
60
  specification_version: 4
59
61
  summary: Smulating mouse click, cursor movement and keystrokes