auto_click 0.1.15 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,11 +1,11 @@
1
1
  0.1.15
2
- Add more general mouse control methods: mouse_down(keyname), mouse_up(keyname)
2
+ Add more general mouse control methods: mouse_down(button_name), mouse_up(button_name)
3
3
 
4
4
  0.1.14
5
5
  Add middle_click and double_click
6
6
 
7
7
  0.1.12
8
- super ugly implementation of that method type (need refactoring or even rewite later)
8
+ super ugly implementation of the method type (need refactoring or even rewite later)
9
9
 
10
10
  0.1.10
11
11
  implement get_key_state method
@@ -40,9 +40,9 @@ Suppose the notepad window on the top left corner of the screen, to type "Auto C
40
40
 
41
41
  mouse_move(100,100)
42
42
  leftclick
43
- type('Auto Click')
43
+ type('Auto Click!')
44
44
 
45
- The type method will Send keystroke for every characters of the string. It will ensure that the capslock is off and hold shift when it is typing a capital character.
45
+ The type method will Send keystroke for every characters of the string. It will ensure that the capslock is off and hold shift when it is typing a capital character or a character that need shift down (e.g. '!').
46
46
  Notice that you need to escape the character \ and ' in single quote string, and you need to escape \ " and # in double quote string.
47
47
  For example, to type #''\ , you can either do:
48
48
 
@@ -54,12 +54,19 @@ or
54
54
 
55
55
  == Advanced Usage
56
56
 
57
- The methods shown in Basic Usage is convenient, but sometimes you may need more control on your mouse action and key strokes.
57
+ The methods shown in Basic Usage are convenient, but sometimes you may need more control on your mouse actions and key strokes.
58
58
 
59
- To show the current cursor position:
59
+ To show the current cursor x and y position in pixels:
60
60
 
61
- puts cursor_position
61
+ puts cursor_position[0]
62
+ puts cursor_position[1]
63
+
64
+ To move the mouse cursor downward 300 pixels
62
65
 
66
+ mouse_move(cursor_position[0]+300,cursor_position[1])
67
+
68
+ Yes this is not very efficient but mouse_move_relative methods will be implemented in later releases.
69
+
63
70
  If you wish to left click and hold:
64
71
 
65
72
  mouse_down(:left)
@@ -67,8 +74,22 @@ If you wish to left click and hold:
67
74
  And remember to release the button later:
68
75
 
69
76
  mouse_up(:left)
70
-
71
- To get more refine control of key stroke simulation, you can use the method key_stroke, key_up and key_down methods
77
+
78
+ To perform a double_click, instead of using:
79
+
80
+ double_click
81
+
82
+ You can use two click calls:
83
+
84
+ left_click
85
+ left_click
86
+
87
+ And of course if for some reasons you need double middle mouse click, you can:
88
+
89
+ middle_click
90
+ middle_click
91
+
92
+ For get more refined control to key strokes simulation, you can use the method key_stroke, key_up and key_down methods
72
93
 
73
94
  To send keystroke 'a':
74
95
 
@@ -78,7 +99,7 @@ To send keystroke tab:
78
99
 
79
100
  key_stroke('tab')
80
101
 
81
- Therefore, to type "Auto Click" , you can either use the simple type method stated basic usage section, or you can do:
102
+ Therefore, to type "Auto Click!" , you can either use the simple type method stated basic usage section, or you can do:
82
103
 
83
104
  key_down('shift')
84
105
  key_stroke('a')
@@ -94,6 +115,9 @@ Therefore, to type "Auto Click" , you can either use the simple type method stat
94
115
  key_stroke('i')
95
116
  key_stroke('c')
96
117
  key_stroke('k')
118
+ key_down('shift')
119
+ key_stroke('num1')
120
+ key_up('shift')
97
121
 
98
122
  And you can have detail adjustments to the keyboard behaviour that you need.
99
123
 
@@ -104,6 +128,13 @@ Notice that 'a' means the key 'a' instead of the letter 'a'. Therefore key_strok
104
128
  key_up('shift')
105
129
 
106
130
  A list of key stroke names will be included in the readme later. 'a' to 'z', 'num0' to 'num9', 'f1' to 'f12', 'shift' 'ctrl' 'alt' 'win' 'tab' 'del' 'ins' 'return' 'esc' 'pageup' 'pagedown' 'left' 'right' 'up' 'down' 'equal' 'hyphen'......etc are all acceptable key names.
131
+ I am trying to cater a certain number of name variations, for example:
132
+
133
+ key_stroke('left')
134
+ key_stroke('leftarrow')
135
+ key_stroke('leftkey')
136
+
137
+ will do the same thing.
107
138
 
108
139
  If you know the virtual key code you can directly enter the key code, for example:
109
140
 
@@ -113,21 +144,9 @@ is the same as
113
144
 
114
145
  key_stroke('a')
115
146
 
116
- To perform a double_click, instead of using
117
-
118
- double_click
119
-
120
- You can use two click calls
121
-
122
- left_click
123
- left_click
147
+ The list of virtual key codes can be found at http://msdn.microsoft.com/en-us/library/dd375731(v=vs.85).aspx
124
148
 
125
- And of course if for some reasons you need double middle mouse click, you can:
126
-
127
- middle_click
128
- middle_click
129
-
130
- There are some methods which is not discussed here. Please see the following Method List for all the available methods.
149
+ There are some methods which are not discussed here. Please see the following Method List for all the available methods.
131
150
 
132
151
  == Method List
133
152
 
@@ -141,6 +160,8 @@ There are some methods which is not discussed here. Please see the following Met
141
160
 
142
161
  - mouse_down(button_name)
143
162
 
163
+ - mouse_up(button_name)
164
+
144
165
  - cursor_position
145
166
 
146
167
  - mouse_move(x,y)
@@ -159,14 +180,24 @@ There are some methods which is not discussed here. Please see the following Met
159
180
 
160
181
  - key_up(key_name)
161
182
 
183
+ == To Do List
184
+
185
+ - Add options of movement speed of mouse so the cursor is actually "moving" instead of just show up at the destination instantly
186
+
187
+ - GetWindow and GetWindowFocus Method
188
+
189
+ - Refactor the ugly type(string) method
190
+
191
+ - More effective way to move mouse relative to current position
192
+
162
193
  == Change log
163
194
  (for full change log please refer to the CHANGELOG file in the repository)
164
195
 
165
- - 0.1.15 Add more general mouse control methods: mouse_down(keyname), mouse_up(keyname)
196
+ - 0.1.15 Add more general mouse control methods: mouse_down(button_name), mouse_up(button_name)
166
197
 
167
198
  - 0.1.14 Add middle_click and double_click
168
199
 
169
- - 0.1.12 Super ugly implementation of that method type (need refactoring or even rewite later)
200
+ - 0.1.12 Super ugly implementation of the method type (need refactoring or even rewite later)
170
201
 
171
202
  - 0.1.10 Implement get_key_state method. Refine the key_stroke, key_down and key_up method
172
203
 
@@ -190,7 +221,7 @@ There are some methods which is not discussed here. Please see the following Met
190
221
 
191
222
  MIT license
192
223
 
193
- Copyright (C) 2010 by Tom Lam
224
+ Copyright (C) 2010-2011 by Tom Lam
194
225
 
195
226
  Permission is hereby granted, free of charge, to any person obtaining a copy
196
227
  of this software and associated documentation files (the "Software"), to deal
@@ -2,7 +2,7 @@ require 'dl/import'
2
2
  require 'auto_click/input_structure'
3
3
  require 'auto_click/virtual_key'
4
4
  require 'auto_click/user32'
5
-
5
+
6
6
  module AutoClick
7
7
 
8
8
  @@rightdown = InputStructure.mouse_input(0,0,0,0x0008)
@@ -15,7 +15,7 @@ module AutoClick
15
15
  def send_input(inputs)
16
16
  n = inputs.size
17
17
  ptr = inputs.collect {|i| i.to_s}.join
18
- User32.SendInput(n, ptr, inputs[0].size)
18
+ User32.SendInput(n, ptr, inputs[0].size)
19
19
  end
20
20
 
21
21
  def mouse_move(x,y)
@@ -1,3 +1,3 @@
1
1
  module AutoClick
2
- VERSION = "0.1.15"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,38 +1,30 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: auto_click
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 1
8
- - 15
9
- version: 0.1.15
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease: !!null
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - erinata
13
- autorequire:
9
+ autorequire: !!null
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2011-01-13 00:00:00 -06:00
18
- default_executable:
12
+ date: 2011-02-05 00:00:00.000000000 -06:00
13
+ default_executable: !!null
19
14
  dependencies: []
20
-
21
- description: |-
22
- Provide several Ruby methods for simulating mouse click, cursor movement and keystrokes in Windows.
23
- This gem use DL library and SendInput method so there is no dependency on FFI, AutoIt or Win32-api.
24
- Methods include mouse_move(x,y), left_click, right_click, type(string), mouse_scroll(steps), key_up, key_down...etc.
25
- See https://github.com/erinata/auto_click for more details about instalation and usage.
26
- (More control over mouse movement such as speed or locus will be implemented in future releases)
27
- email:
15
+ description: ! "Provide several Ruby methods for simulating mouse click, cursor movement
16
+ and keystrokes in Windows. \n This gem use DL library and SendInput
17
+ method so there is no dependency on FFI, AutoIt or Win32-api. \n Methods
18
+ include mouse_move(x,y), left_click, right_click, type(string), mouse_scroll(steps),
19
+ key_up, key_down...etc.\n See https://github.com/erinata/auto_click
20
+ for more details about instalation and usage.\n (More control
21
+ over mouse movement such as speed or locus will be implemented in future releases)"
22
+ email:
28
23
  - erinata@gmail.com
29
24
  executables: []
30
-
31
25
  extensions: []
32
-
33
26
  extra_rdoc_files: []
34
-
35
- files:
27
+ files:
36
28
  - .gitignore
37
29
  - CHANGELOG
38
30
  - Gemfile
@@ -48,36 +40,26 @@ files:
48
40
  has_rdoc: true
49
41
  homepage: https://github.com/erinata/auto_click
50
42
  licenses: []
51
-
52
- post_install_message:
43
+ post_install_message: !!null
53
44
  rdoc_options: []
54
-
55
- require_paths:
45
+ require_paths:
56
46
  - lib
57
- required_ruby_version: !ruby/object:Gem::Requirement
47
+ required_ruby_version: !ruby/object:Gem::Requirement
58
48
  none: false
59
- requirements:
60
- - - ">="
61
- - !ruby/object:Gem::Version
62
- segments:
63
- - 1
64
- - 9
65
- - 0
49
+ requirements:
50
+ - - ! '>='
51
+ - !ruby/object:Gem::Version
66
52
  version: 1.9.0
67
- required_rubygems_version: !ruby/object:Gem::Requirement
53
+ required_rubygems_version: !ruby/object:Gem::Requirement
68
54
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- segments:
73
- - 0
74
- version: "0"
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
75
59
  requirements: []
76
-
77
- rubyforge_project:
78
- rubygems_version: 1.3.7
79
- signing_key:
60
+ rubyforge_project: !!null
61
+ rubygems_version: 1.5.0
62
+ signing_key: !!null
80
63
  specification_version: 3
81
64
  summary: Smulating mouse click, cursor movement and keystrokes
82
65
  test_files: []
83
-