-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathchrome.red
More file actions
64 lines (55 loc) · 1.98 KB
/
Copy pathchrome.red
File metadata and controls
64 lines (55 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
Red [
Title: "chrome.3.red"
Iterations: [
0.0.0.3.7 {added | "take screenshot of " copy arg1 to space " in " copy arg2 to end }
0.0.0.3.6 {added | "take screenshot" copy arg1 to space copy arg2 to space to newline }
0.0.0.3.5 {added | "Usage: take-screenshot"}
0.0.0.3.4 {fixed}
0.0.0.3.3 {debugging}
0.0.0.3.2 {debugging}
0.0.0.3.1 {*** Syntax Error: {"lazy-load-chrome take-screenshot ;}}
]
]
load-take-screenshot: function [][
unless value? 'take-screenshot [
either exists? %chrome/take-screenshot.2.red [
do %chrome/take-screenshot.2.red
][
do https://redlang.red/chrome/take-screenshot.red
]
return true
]
return false
]
lazy-load-chrome: function ['>function][
.function: form >function
switch .function [
"take-screenshot" [
load-take-screenshot
]
]
]
system/lexer/pre-load: func [src part][
parse src [
any [
s: [
["take-screenshot:" | "take-screenshot." | "Usage: take-screenshot"]
] skip
|
s: [
[
"take-screenshot" copy arg1 to space copy arg2 to space to newline
| "take-screenshot" copy arg1 to space copy arg2 to end
"take screenshot" copy arg1 to space copy arg2 to space to newline
| "take screenshot" copy arg1 to space copy arg2 to end
"take screenshot of " copy arg1 to space " in " copy arg2 to space to newline
| "take screenshot of " copy arg1 to space " in " copy arg2 to end
]
(new: rejoin ["lazy-load-chrome take-screenshot" newline "take-screenshot" { } arg1 { } arg2] )
] e: (s: change/part s new e) :s
| skip
]
]
]
;do {take screenshot https://google.com c:\test\chrome.6.png}
;do %chrome/take-screenshot.red