Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6c0387e

Browse files
authoredJun 23, 2016
Update README.md
1 parent d2119be commit 6c0387e

File tree

1 file changed

+40
-20
lines changed

1 file changed

+40
-20
lines changed
 

‎README.md

+40-20
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,52 @@ with the benefit of all the existing modules on [npm][].
66

77
There's a project that's further ahead in development called [RobotJS][].
88

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
2037
```
2138

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.
2540

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+
```
2947

3048
With Edge.js, everything can be [syncronous or asyncronous][sync vs async].
3149

3250
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
3553
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.
3755
I only got a few functions more or less working
3856
without modifying IronAHK.
3957

@@ -46,4 +64,6 @@ so definitely check out [RobotJS][].
4664
[Edge.js]: http://tjanczuk.github.io/edge/
4765
[sync vs async]: http://tjanczuk.github.io/edge/#/27
4866
[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
4969
[RobotJS]: https://github.com/octalmage/robotjs

0 commit comments

Comments
 (0)
Please sign in to comment.