-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_clip_html.ahk
87 lines (73 loc) · 1.9 KB
/
read_clip_html.ahk
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
text_save := ""
skip_line := 0
selection := ""
selection_id := 0
clip := Clipboard
Loop, parse, clip, `n, `r
{
;---- Selection Detection ----
If (RegExMatch(A_LoopField, "<!DOCTYPE html>"))
{
selection := "head"
}
If (RegExMatch(A_LoopField, "Sample<\/h3>"))
{
selection := "sample_start"
}
If (selection_id = 2)
{
If (RegExMatch(A_LoopField, "<\/p>"))
{
selection := "sample_end"
}
}
If (RegExMatch(A_LoopField, "<\/body>"))
{
break
}
;------- Selection Rule --------
If (selection = "head")
{
skip := 28
text_save .= "<head>`n"
text_save .= "<meta http-equiv='X-UA-Compatible' content='IE=edge'></meta>`n"
text_save .= "<meta http-equiv='content-type' content='text/html; charset=utf-8'>`n"
text_save .= "<style type='text/css'>`n"
selection := ""
selection_id := 1
}
If (selection = "sample_start")
{
text_save .= A_LoopField "`n"
text_save .= "<button class='tspoiler' onclick='tspoiler();'>Show/Hide</button>`n"
text_save .= "<div id='spoiler' style='display: none;'>`n"
selection := ""
selection_id := 2
Continue
}
If (selection = "sample_end")
{
text_save .= A_LoopField "`n"
text_save .= "</div>`n"
selection := ""
selection_id := 3
Continue
}
;--------------------------------
If (A_Index < skip)
{
Continue
}
;--------------------------------
text_save .= A_LoopField "`n"
}
Clipboard := text_save
FileDelete, %A_WorkingDir%\info.html
FileAppend, %text_save%, %A_WorkingDir%\info.html
Gui, Add, Edit, w800 r40,% text_save
Gui, Show
MsgBox, 0x0, , Finished, 0.2
ExitApp
return
GuiClose:
ExitApp