@@ -6,34 +6,52 @@ with the benefit of all the existing modules on [npm][].
6
6
7
7
There's a project that's further ahead in development called [ RobotJS] [ ] .
8
8
9
- The API would be fun, with clever usage of concatenation and optional globals:
10
-
11
- ``` js
12
- on (Ctrl+ Alt+ C , ()=>
13
- oldClipboard = getClipBoard ();
14
- send (Ctrl+ C );
15
- newClipboard = getClipBoard ();
16
- setClipBoard (oldClipboard);
17
- send (Ctrl+ V );
18
- setClipBoard (newClipboard);
19
- );
9
+ It could have a playful API with clever usage of concatenation and optional globals.
10
+
11
+ The following example is in [ CoffeeScript] [ ] , but you could use JavaScript,
12
+ [ TypeScript, DogeScript, Python, Ruby, etc.] [ List of languages that compile to JS ]
13
+
14
+ ``` coffee
15
+ on Ctrl+ Alt+ C, ->
16
+ oldClipboard = getClipboard ()
17
+ send Ctrl+ C
18
+ newClipboard = getClipboard ()
19
+ setClipboard oldClipboard
20
+ send Ctrl+ V
21
+ setClipBoard newClipboard
22
+ ```
23
+
24
+ All the keyboard constants would be strings
25
+ with control characters at the start and end,
26
+ to differenciate between e.g. ` Ctrl+Esc ` and `"Ctrl+Esc"``.
27
+ That would mean you wouldn't accidently
28
+ send commands when you wanted to send text
29
+ (but sending arbitrary user input would still be dangerous).
30
+
31
+ There could also be "AutoHotQuery" (` ahq ` )
32
+ with a jQuery-like API for selecting and operating on windows.
33
+
34
+ ``` coffee
35
+ $ (/ Google Chrome| Mozilla Firefox| Microsoft Edge/ ).focus ()
36
+ .then -> Send Ctrl+ T, " google.com" , Enter
20
37
```
21
38
22
- All the keyboard constants would be strings with control characters at the start and end, to differenciate between e.g. ` Ctrl+Esc ` and `"Ctrl+Esc"``.
23
- That would mean you wouldn't accidently send commands when you wanted to send text, but sending arbitrary user input would still be dangerous.
24
- (So maybe that's not the best design decision anyways.)
39
+ Look, no ` SetTitleMatchMode ` ! Amazing.
25
40
26
- I'm also thinking there could be "AutoHotQuery" (` ahq ` )
27
- with a semi-jQuery-like API for selecting and operating on windows.
28
- (` $(/wow, no SetTitleMatchMode! amazing!/i, optional callback) ` )
41
+ That would open a new tab in one browser window.
42
+ To open new tabs in each matched window, you could do:
43
+
44
+ ``` coffee
45
+ $ (/ Google Chrome| Mozilla Firefox| Microsoft Edge/ ).send (Ctrl+ T, " google.com" , Enter)
46
+ ```
29
47
30
48
With Edge.js, everything can be [ syncronous or asyncronous] [ sync vs async ] .
31
49
32
50
The creator of IronAHK did try to make it modular
33
- (and let's face it, it could be infinitely worse)
34
- but they did let paradigms like ` ErrorLevel ` and other global state
51
+ (and it could be much worse)
52
+ but they still let paradigms like ` ErrorLevel ` and other global state
35
53
seep into the core.
36
- IronAHK would need to be refactored or much more easily cannibalized in order to implement much of the functionality.
54
+ IronAHK would need to be refactored or more likely cannibalized in order to implement much of the functionality.
37
55
I only got a few functions more or less working
38
56
without modifying IronAHK.
39
57
@@ -46,4 +64,6 @@ so definitely check out [RobotJS][].
46
64
[ Edge.js ] : http://tjanczuk.github.io/edge/
47
65
[ sync vs async ] : http://tjanczuk.github.io/edge/#/27
48
66
[ npm ] : https://www.npmjs.com/
67
+ [ CoffeeScript ] : http://coffeescript.org/
68
+ [ List of languages that compile to JS ] : https://github.com/jashkenas/coffeescript/wiki/list-of-languages-that-compile-to-js
49
69
[ RobotJS ] : https://github.com/octalmage/robotjs
0 commit comments