mabicro 1.2.0 → 1.2.3
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/lib/mabicro.rb +11 -4
- metadata +1 -1
data/lib/mabicro.rb
CHANGED
@@ -13,7 +13,7 @@ $moveCursor = Win32API.new(MABICRO_DLL_PREFIX + "mabicro", "MouseTo", "II")
|
|
13
13
|
$sendMouseDown = Win32API.new(MABICRO_DLL_PREFIX + "mabicro", "MouseDown", "I")
|
14
14
|
$sendMouseUp = Win32API.new(MABICRO_DLL_PREFIX + "mabicro", "MouseUp", "I")
|
15
15
|
|
16
|
-
$getKeyState = Win32API.new(
|
16
|
+
$getKeyState = Win32API.new("user32", "GetAsyncKeyState", "I", "I")
|
17
17
|
|
18
18
|
LEFT = 1
|
19
19
|
RIGHT = 2
|
@@ -36,10 +36,17 @@ def keyPressed?(key)
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def sendKeyDown(key)
|
40
40
|
$sendKeyDown.call key.upcase.ord
|
41
|
+
end
|
42
|
+
def sendKeyUp(key)
|
43
|
+
$sendKeyUp.call key.upcase.ord
|
44
|
+
end
|
45
|
+
|
46
|
+
def sendSingleKey(key, delay=0.01)
|
47
|
+
sendKeyDown key.upcase.ord
|
41
48
|
sleep delay
|
42
|
-
|
49
|
+
sendKeyUp key.upcase.ord
|
43
50
|
end
|
44
51
|
def sendInput(msg, delay=0.01)
|
45
52
|
msg.each_char do |ch|
|
@@ -61,7 +68,7 @@ def sendClick(btn=LEFT, delay=0.1)
|
|
61
68
|
sendMouseUp btn
|
62
69
|
end
|
63
70
|
|
64
|
-
def
|
71
|
+
def moveCursor(x,y)
|
65
72
|
$moveCursor.call x,y
|
66
73
|
end
|
67
74
|
|