keystroker 0.1.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/keystroker.rb +150 -2
- data.tar.gz.sig +0 -0
- metadata +29 -28
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed142ed5ba422dddc8c4a9da1b8b7820104152906d2ee6ca235f8480754db43d
|
4
|
+
data.tar.gz: a01c4006757fec9849011bcc10f2fcc8826c9992bdd52442916548754200bd76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32a045c0ba59e05a84c5ef18496d78767238ee2f5930ed430dcee5a1603441118d36753e509a081a6c53396412c19a00e65cad4dd617dac8060924e57b22302f
|
7
|
+
data.tar.gz: 76083e77dff06fdd57370ed8a28b407d0cd0d2266e0dba865b6bd78fffaeb000e9d3ed1a06807900208887fc6bdafbd7d131cb1d9083e0d6b4de150745f0ad80
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/keystroker.rb
CHANGED
@@ -19,10 +19,30 @@ require 'rexle-builder'
|
|
19
19
|
class Keystroker
|
20
20
|
using ColouredText
|
21
21
|
|
22
|
-
def initialize(debug: false)
|
22
|
+
def initialize(kbml='<kbml/>', debug: false)
|
23
|
+
|
23
24
|
@debug = debug
|
25
|
+
|
26
|
+
@doc = if kbml then
|
27
|
+
|
28
|
+
s, _ = RXFHelper.read(kbml)
|
29
|
+
|
30
|
+
head, body = s.lines[0].chomp, s.lines[1..-1].join
|
31
|
+
puts 'head:' + head.inspect if @debug
|
32
|
+
|
33
|
+
case head
|
34
|
+
when /<\?kbml\?\>/
|
35
|
+
parse_slim(body)
|
36
|
+
when /<\?hg0\?\>/
|
37
|
+
parse_hg0(body)
|
38
|
+
else
|
39
|
+
Rexle.new(s)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
24
44
|
end
|
25
|
-
|
45
|
+
|
26
46
|
def parse_hg0(s)
|
27
47
|
|
28
48
|
xml = RexleBuilder.new
|
@@ -72,13 +92,141 @@ class Keystroker
|
|
72
92
|
@doc = Rexle.new(a3)
|
73
93
|
|
74
94
|
end
|
95
|
+
|
96
|
+
def parse_slim(s)
|
97
|
+
|
98
|
+
puts 'inside parse_slim' if @debug
|
99
|
+
|
100
|
+
a = s.strip.lines.map do |line|
|
101
|
+
|
102
|
+
head, rawbody = line.chomp.split(/ +/,2)
|
103
|
+
body = rawbody ? rawbody.strip : nil
|
104
|
+
puts 'head: ' + head.inspect if @debug
|
105
|
+
|
106
|
+
case head.to_sym
|
107
|
+
when :activate
|
108
|
+
[:window, {activate: body}]
|
109
|
+
when :enter
|
110
|
+
[:enter, {}]
|
111
|
+
when :sleep
|
112
|
+
[:sleep, {duration: body}]
|
113
|
+
when :tab
|
114
|
+
[:tab, {times: body}]
|
115
|
+
when :type
|
116
|
+
[:type, {}, body]
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
|
121
|
+
rawxml = ['kbml', {}, '', *a]
|
122
|
+
|
123
|
+
@doc = Rexle.new(rawxml)
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
def to_au3()
|
128
|
+
|
129
|
+
a = []
|
130
|
+
|
131
|
+
@doc.root.each_recursive do |x|
|
132
|
+
|
133
|
+
next unless x
|
134
|
+
|
135
|
+
if x.name == 'type' then
|
136
|
+
a << ''
|
137
|
+
a << %Q{Send("%s")} % x.text
|
138
|
+
else
|
139
|
+
|
140
|
+
modifiers = {ctrl: '^', shift: '+', alt: '!', win: '#'}
|
141
|
+
|
142
|
+
instruction = if modifiers[x.name.to_sym] then
|
143
|
+
modifiers[x.name.to_sym]
|
144
|
+
else
|
145
|
+
"{%s}" % x.name.upcase
|
146
|
+
end
|
147
|
+
|
148
|
+
if x.attributes[:key] then
|
149
|
+
instruction += '' + x.attributes[:key] + ''
|
150
|
+
end
|
151
|
+
|
152
|
+
a << %Q{Send("%s")} % instruction
|
153
|
+
a << '' if x.name == 'enter'
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
|
158
|
+
puts a.join("\n")
|
159
|
+
end
|
160
|
+
|
161
|
+
def to_doc()
|
162
|
+
@doc
|
163
|
+
end
|
75
164
|
|
76
165
|
def to_hg0()
|
166
|
+
|
167
|
+
a = []
|
168
|
+
|
169
|
+
@doc.root.each_recursive do |x|
|
170
|
+
|
171
|
+
if @debug then
|
172
|
+
puts ('x:' + x.inspect).debug
|
173
|
+
puts ('x2: ' + x.next_sibling.inspect).debug
|
174
|
+
end
|
175
|
+
|
176
|
+
next unless x
|
177
|
+
|
178
|
+
if x.name == 'type' then
|
179
|
+
a << ' ' + x.text
|
180
|
+
else
|
181
|
+
instruction = x.name
|
182
|
+
instruction += '+' + x.attributes[:key] if x.attributes[:key]
|
183
|
+
a << ' {' + instruction + '}'
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
a.join.lstrip
|
189
|
+
|
77
190
|
end
|
78
191
|
|
79
192
|
def to_kbml(options={})
|
80
193
|
@doc.xml(options)
|
81
194
|
end
|
195
|
+
|
196
|
+
def to_vbs()
|
197
|
+
|
198
|
+
a = []
|
199
|
+
|
200
|
+
@doc.root.each_recursive do |x|
|
201
|
+
|
202
|
+
next unless x
|
203
|
+
|
204
|
+
if x.name == 'type' then
|
205
|
+
a << ''
|
206
|
+
a << %Q(WshShell.SendKeys "%s") % x.text
|
207
|
+
else
|
208
|
+
|
209
|
+
modifiers = {ctrl: '^', shift: '+', alt: '%'}
|
210
|
+
|
211
|
+
instruction = if modifiers[x.name.to_sym] then
|
212
|
+
modifiers[x.name.to_sym]
|
213
|
+
else
|
214
|
+
"{%s}" % x.name.upcase
|
215
|
+
end
|
216
|
+
|
217
|
+
if x.attributes[:key] then
|
218
|
+
instruction += '{' + x.attributes[:key] + '}'
|
219
|
+
end
|
220
|
+
|
221
|
+
a << %Q(WshShell.SendKeys "%s") % instruction
|
222
|
+
a << '' if x.name == 'enter'
|
223
|
+
end
|
224
|
+
|
225
|
+
end
|
226
|
+
|
227
|
+
a.prepend('Set WshShell = WScript.CreateObject("WScript.Shell")' + "\n")
|
228
|
+
puts a.join("\n")
|
229
|
+
end
|
82
230
|
|
83
231
|
end
|
84
232
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: keystroker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -11,31 +11,31 @@ cert_chain:
|
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
/
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjExMTAxMTkyNTAzWhcN
|
15
|
+
MjIxMTAxMTkyNTAzWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDCAvNZ
|
17
|
+
/1408mppDFtAcri9zzUDBs7jxPntSmEeHzzobmIFAa9h0wzpKI+AXeAYqqoq4GsB
|
18
|
+
DYAdjmAc7eecwl+2igs8cBfkUUuda94M8OHXf4fqySlBQ9C/Dl8AOoJ/XS1dZk/T
|
19
|
+
MG4Hf3Z0IcDxOc9GGAX9/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N1uFFJ
|
33
|
+
T28ZyYUE864Ax6SefYSsxlkab5hdFM3Db1ROIHykYbnYe//TvNKsHYiQOUwvTSGG
|
34
|
+
hI0DD1D+geYMtF+Y1xrI45mbHpn/941eFisilV3aEe+0EKoTap9+1Do+1hvYhKbX
|
35
|
+
pASYKhX3vW2JN5Mw86tKD+7D/pVZxC634uW4iPxYlEq55we9qONZZjNDV6o8GkNM
|
36
|
+
bftgnKRTJ/vGAKyn94ZSwwXt
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date:
|
38
|
+
date: 2021-11-01 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: rexle
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
version: '1.5'
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 1.5.
|
49
|
+
version: 1.5.11
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -56,9 +56,9 @@ dependencies:
|
|
56
56
|
version: '1.5'
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.5.
|
59
|
+
version: 1.5.11
|
60
60
|
description:
|
61
|
-
email:
|
61
|
+
email: digital.robertson@gmail.com
|
62
62
|
executables: []
|
63
63
|
extensions: []
|
64
64
|
extra_rdoc_files: []
|
@@ -83,7 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
- !ruby/object:Gem::Version
|
84
84
|
version: '0'
|
85
85
|
requirements: []
|
86
|
-
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.7.10
|
87
88
|
signing_key:
|
88
89
|
specification_version: 4
|
89
90
|
summary: Makes it easier to convert keystrokes from 1 format to another. Primary format
|
metadata.gz.sig
CHANGED
Binary file
|