auto_click 0.4.0 → 0.4.3

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: 0be5f4d186b5d45728b0990a7137bf8e3eee422de81c2b0b4d9d26d9d22ebdf9
4
- data.tar.gz: ac2002bdf768013f339c8a74d9315994659084f1c951016911908d76ba1d9d6f
3
+ metadata.gz: 47d56fa17310e18867a710aef8a980ffb8b58ac4a656e1abea7d5f8b26bbece7
4
+ data.tar.gz: c6bc2650e7f044871fb06b253bc09c6efe63709590bde4440511c30ac9291e5d
5
5
  SHA512:
6
- metadata.gz: 24cfdf7e6b60e86d41b270593bef4dd6a0c4bc08d3b8c407d07301c0c51518770915eecd453244e5a64461056888f12ed0cff36d1f8f83025c2370a81522faac
7
- data.tar.gz: 12771b1b1e3acc1f69b5e19d136abee87c17236571c9237a9269c7eff2cfde494bd2cbcb102326fefe5d36efae853e4a8cc20c6fe3f62f9ffd7d84222396830b
6
+ metadata.gz: fa65e21e050acd7df0a6b2e0dbd752c3c0ff71cc0192469fef623a2857dfd263b7052d72d7a436b1cb0db51bed7d79c9d493676c51b510e6a30f57960e8a8bb7
7
+ data.tar.gz: c5f66a8bd2dae391a48d33e5a1eb95d6612857329cfc6f8ba18919f498830ce5b2cddf9d77e1faa5af7ea39a65059ebcbf42c2c38849f87a30ce706b07969f7b
data/.gitignore CHANGED
@@ -4,3 +4,4 @@ pkg/*
4
4
  test_build.rb
5
5
  test_run.rb
6
6
  .project
7
+ test.rb
data/CHANGELOG CHANGED
@@ -1,3 +1,8 @@
1
+
2
+
3
+ 0.4.3
4
+ Add mouse_move_percentage and get_screen_resolution
5
+
1
6
  0.4.0
2
7
  Fix the 64bit bug and Fixnum! bug
3
8
 
@@ -23,6 +23,10 @@ To move the mouse cursor to 50,50 and perform a right click:
23
23
 
24
24
  mouse_move(50,50)
25
25
  right_click
26
+
27
+ To move the mouse cursor to the middle of the screen:
28
+
29
+ mouse_move_percentage(0.5,0.5)
26
30
 
27
31
  To scroll up (forward) 10 wheel steps:
28
32
 
@@ -38,8 +42,6 @@ To get the current cursor position
38
42
 
39
43
  To drag the icon on (50,50) to (200,300):
40
44
 
41
-
42
-
43
45
  left_drag(50,50,200,300)
44
46
 
45
47
  Suppose the notepad window on the top left corner of the screen, to type "Auto Click" in notepad. (Methods like get_windows("notepad") will be implemented in future release. So that you do not need to use this left click things to get focus on the notepad window......in later release......)
@@ -172,6 +174,8 @@ There are some methods which are not discussed here. Please see the following Me
172
174
 
173
175
  - mouse_move(x,y)
174
176
 
177
+ - mouse_move_percentage(x_percent,y_percent)
178
+
175
179
  - mouse_scroll(step)
176
180
 
177
181
  - left_drag(x_start,y_start,x_end,y_end)
@@ -188,38 +192,27 @@ There are some methods which are not discussed here. Please see the following Me
188
192
 
189
193
  == To Do List
190
194
 
195
+ - Backward compatibility with 32-bit ruby
196
+
191
197
  - Add options of movement speed of mouse so the cursor is actually "moving" instead of just show up at the destination instantly
192
198
 
193
199
  - GetWindow and GetWindowFocus Method
194
200
 
195
- - Refactor the ugly type(string) method
201
+ - Refactor the ugly type(string) method
202
+
203
+ - Use code block to implement modifier keys
196
204
 
197
205
  - More effective way to move mouse relative to current position
198
206
 
199
207
  == Change log
200
208
  (for full change log please refer to the CHANGELOG file in the repository)
201
209
 
210
+ - 0.4.3 Add mouse_move_percentage and get_screen_resolution
211
+
202
212
  - 0.4.0 Fix the 64bit bug and Fixnum! bug
203
213
 
204
214
  - 0.3.0 Update to use DL Library
205
215
 
206
- - 0.2.0 bump verison
207
-
208
- - 0.1.15 Add more general mouse control methods: mouse_down(button_name), mouse_up(button_name)
209
-
210
- - 0.1.14 Add middle_click and double_click
211
-
212
- - 0.1.12 Super ugly implementation of the method type (need refactoring or even rewite later)
213
-
214
- - 0.1.10 Implement get_key_state method. Refine the key_stroke, key_down and key_up method
215
-
216
- - 0.1.9 Add support for keybaord region specific keys using US-keyboard standard
217
-
218
- - 0.1.8 Implement key_stroke, key_down and key_up
219
-
220
- - 0.1.7 Primitive implementation of key_stroke. Need good api before putting it into method list
221
-
222
- - 0.1.4 Implement left_drag and right_drag
223
216
 
224
217
  == License
225
218
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
16
16
  See https://github.com/erinata/auto_click for more details about instalation and usage.
17
17
  (More control over mouse movement such as speed or locus will be implemented in future releases)}
18
18
 
19
- s.required_ruby_version = '>= 1.9.0'
19
+ s.required_ruby_version = '>= 2.3.0'
20
20
 
21
21
  s.files = `git ls-files`.split("\n")
22
22
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
@@ -10,41 +10,50 @@ module AutoClick
10
10
  @@leftup = InputStructure.mouse_input(0,0,0,0x0004)
11
11
  @@middledown = InputStructure.mouse_input(0,0,0,0x0020)
12
12
  @@middleup = InputStructure.mouse_input(0,0,0,0x0040)
13
-
14
-
13
+
14
+
15
15
  def send_input(inputs)
16
16
  n = inputs.size
17
17
  ptr = inputs.collect {|i| i.to_s}.join
18
18
  User32.SendInput(n, ptr, inputs[0].size)
19
19
  end
20
20
 
21
+ def get_screen_resolution
22
+ [User32.GetSystemMetrics(0), User32.GetSystemMetrics(1)]
23
+ end
24
+
21
25
  def mouse_move(x,y)
22
26
  User32.SetCursorPos(x,y)
23
27
  end
24
-
25
- def mouse_move_pixel_absolute(x,y)
26
- User32.SetCursorPos(x,y)
28
+
29
+ def mouse_move_percentage(x,y)
30
+ screen_resolution = get_screen_resolution()
31
+ User32.SetCursorPos(get_screen_resolution[0]*x,get_screen_resolution[1]*y)
27
32
  end
28
33
 
29
- def mouse_move_percentage_relative_virtual(x,y) # broken
30
- move = InputStructure.mouse_input(x,y,0,0x0001)
31
- send_input( [move])
32
- end
34
+ # def mouse_move_pixel_absolute(x,y)
35
+ # User32.SetCursorPos(x,y)
36
+ # end
33
37
 
34
- def mouse_move_percentage_relative_real(x,y) # broken
35
- move = InputStructure.mouse_input(x,y,0,0x4001)
36
- send_input( [move])
37
- end
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
38
42
 
39
- def mouse_move_percentage_absolute_virtual(x,y)
40
- move = InputStructure.mouse_input(x*65536,y*65536,0,0xc001)
41
- send_input( [move])
42
- end
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
43
47
 
44
- def mouse_move_percentage_absolute_real(x,y)
45
- move = InputStructure.mouse_input(x*65536,y*65536,0,0x8001)
46
- send_input( [move])
47
- end
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
48
57
 
49
58
  def right_click
50
59
  send_input( [@@rightdown, @@rightup] )
@@ -5,4 +5,5 @@ module User32
5
5
  extern "int SetCursorPos(int,int)"
6
6
  extern "int SendInput(int,char*,int)"
7
7
  extern "int GetKeyState(int)"
8
+ extern "int GetSystemMetrics(int)"
8
9
  end
@@ -1,3 +1,3 @@
1
1
  module AutoClick
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.3"
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.4.0
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - erinata
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-14 00:00:00.000000000 Z
11
+ date: 2019-05-08 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
@@ -46,7 +46,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.9.0
49
+ version: 2.3.0
50
50
  required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - ">="