keystroker 0.1.2 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b1954898b871cee865038f7b1255300039fedc5cf71a40e0c2ca141b501f0ed
4
- data.tar.gz: e2a0283d4789cf89d206c054871259b82ca70b0fb31a0fe33b84ec69cc719d3e
3
+ metadata.gz: b75f8b6a694515e3f2f8a6c91a293eb8370cbf5ddfc1ac025107eca7096bd604
4
+ data.tar.gz: '098df3f61a7abc1872e7acace5b67cf5bab80db77dc444248e114ab44e31f25b'
5
5
  SHA512:
6
- metadata.gz: 39cec5dbfd2757d0cac19953379ca9660cd0dde2f49b7f9843b8a9cbee57420834135e3f051be9d517d0959092bdf65dd192f905d8d56f0476b98e2dabbbd245
7
- data.tar.gz: 1776c6fda2bc7fa48f497d980e63ea7b2a597f11755116adc2d3cacd7d085915e688cbfec0610aa77fc39209dfece85c80e4919a20bd70c7a3f93eb888e7ef63
6
+ metadata.gz: 23e23faca9095d11545b7c31155e6872559ff38ac22a1feac6a15faaa5e74f1e170c919aaf88383328147eced0b15b2f86f4044361c28764164ba51eb18ad062
7
+ data.tar.gz: 71e575431a3b9d8e9de9758a7c1956b9c5a3e6a4db1c1d6b25aae7c449a85034fd92de0ad9d8177a243b6b678a7994f4875bc25e3ffff19d27822ae28763c64c
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -19,10 +19,15 @@ 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
+ if kbml then
27
+ @doc = Rexle.new(RXFHelper.read(kbml).first)
28
+ end
24
29
  end
25
-
30
+
26
31
  def parse_hg0(s)
27
32
 
28
33
  xml = RexleBuilder.new
@@ -72,6 +77,40 @@ class Keystroker
72
77
  @doc = Rexle.new(a3)
73
78
 
74
79
  end
80
+
81
+ def to_au3()
82
+
83
+ a = []
84
+
85
+ @doc.root.each_recursive do |x|
86
+
87
+ next unless x
88
+
89
+ if x.name == 'type' then
90
+ a << ''
91
+ a << %Q{Send("%s")} % x.text
92
+ else
93
+
94
+ modifiers = {ctrl: '^', shift: '+', alt: '!', win: '#'}
95
+
96
+ instruction = if modifiers[x.name.to_sym] then
97
+ modifiers[x.name.to_sym]
98
+ else
99
+ "{%s}" % x.name.upcase
100
+ end
101
+
102
+ if x.attributes[:key] then
103
+ instruction += '' + x.attributes[:key] + ''
104
+ end
105
+
106
+ a << %Q{Send("%s")} % instruction
107
+ a << '' if x.name == 'enter'
108
+ end
109
+
110
+ end
111
+
112
+ puts a.join("\n")
113
+ end
75
114
 
76
115
  def to_hg0()
77
116
 
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.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file