-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWS_DEDemo2.ahk
206 lines (157 loc) · 4.23 KB
/
WS_DEDemo2.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#include WS_DEControl2.ahk
If (!WS_Initialize("VBScript"))
{
Msgbox % "Error initializing EasyScript"
ExitApp
}
InitComControls()
Gui, +Resize +LastFound +theme
Gui, Add, Button, x0 y0 gSetBold, Bold
Gui, Add, Button, xp+40 gSetItalic,italic
Gui, Add, Button, xp+50 gSetUnderLine, underline
gui, Add, Button, xp+75 gSetBlue, Blue
Gui, Add, Button, xp+40 gSetImageLink, Image
Gui, Add, Button, xp+50 gSetHyperLink, Link
Gui, Add, Button, xp+50 gLoadUrl, LoadURL
Gui, Add, Button, xp+70 gGetDocument, GetHtml
gui, add, button, xp+70 gSetDocument, SetHtml
Gui, Add, button, xp+70 gSaveDocument, SaveHtml
Gui, Add, button, xp+80 gBrowseMode, BrowseMode Toggle
Gui, add, button, x0 yp+25 gSetFontName, SetFontName
Gui, add, button, xp+90 gSetFontSize, SetFontSize
Gui, add, button, xp+90 gSetFont, SetFont
Gui, add, button, xp+50 gList1, List1
Gui, add, button, xp+50 gList2, List2
gui, Add, Button, xp+50 gInsertTable, InsertTable
Gui, add, button, xp+140 gNewDocument, New
Gui, add, button, xp+40 gFindText, FindText
Gui, add, button, xp+70 gSetBackColor, SetBackColor
Gui, Show, w800 h600 Center, DhtmlEdit_Test
hWnd := WinExist()
; Create the COM control
ppvDEdit := DE_Add(hWnd, 0, 50, 800, 550)
Gosub, SetDocument
Return ; end of auto-run
1::
msgbox, % GetSelection()
return
SetBold:
DE_SetBold()
Return
SetItalic:
DE_SetItalic()
Return
SetBlue:
;DE_SetForeColor(DEdit, "0000FF")
DE_SetForeColor("Blue") ; possible way
;DE_SetForeColor(pDHtmlEdit, "#0000FF") ; also possible
Return
SetUnderline:
DE_SetUnderline()
Return
SetImageLink:
DE_SetImage()
Return
SetHyperLink:
DE_SetHyperLink()
Return
LoadUrl:
url := "http://www.autohotkey.com"
DE_LoadUrl(url)
Return
NewDocument:
DE_NewDocument()
Return
SaveDocument:
Filedir = %A_ScriptDir%\DhtmlEdit_%A_Now%.htm
DE_SaveDocument(FileDir)
Return
GetDocument:
msgbox, % DE_GetDocumentHtml()
Return
SetDocument:
htmlcode =
(
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="content-type">
<title></title>
</head>
<body
style="COLOR: rgb(0,0,0); BACKGROUND-COLOR: rgb(255,204,51)" alink
="#ee0000" link="#0000ee" vlink="#551a8b">
<P>
<big style="FONT-FAMILY: Verdana"><big><EM><STRONG>Forgive</STRONG></EM> my <span
style="FONT-WEIGHT: bold; COLOR: rgb(51,51,255)" >poor</span> coding style! Yes?
</big></big></P>
<P><BIG style="FONT-FAMILY: Verdana"><BIG>This File is Edited with
<STRONG>DhtmlEdit_Demo</STRONG>
.<br>
<br></P></BIG></BIG>
<ul style="FONT-FAMILY: Verdana">
<li><STRONG><U>First List</U></STRONG>
<li><FONT color=blue>second List</FONT>
<li><A href="http://www.autohotkey.com">what
now?(</A>click then go to AutohotKey)</li>
</ul>
<br style="FONT-FAMILY: Verdana">
<table
style="WIDTH: 440px; FONT-FAMILY: Verdana; HEIGHT: 52px; TEXT-ALIGN: left"
border="1" cellpadding="2" cellspacing="2">
<tbody>
<tr>
<td>This is a table<br>
and the right image is directly from AutoHotKey Forum.</td>
<td><A href="http://www.autohotkey.com"><img style="WIDTH: 228px; HEIGHT: 133px"
alt="image cannot be loaed for some reason"
src="http://www.autohotkey.com/docs/images/AutoHotkey_logo.gif"></A></td>
</tr>
</tbody>
</table>
</body>
</html>
)
DE_SetDocumentHtml(htmlcode)
htmlcode =
Return
BrowseMode:
DE_BrowseMode()
Return
FindText:
DE_FindText()
Return
SetBackColor:
DE_SetBackColor("Yellow")
Return
SetFontName:
DE_SetFontName("Arial Black")
Return
SetFontSize:
DE_SetFontSize("4")
Return
SetFont:
DE_Font()
Return
List1:
DE_OrderList()
Return
List2:
DE_UnOrderList()
Return
InsertTable:
DE_InsertTable(2,2)
return
GuiSize:
DE_Move(ppvDEdit, 0, 50, A_GuiWidth, A_GuiHeight-50)
Return
GuiClose:
Gui, %A_Gui%:Destroy
ReleaseObject(ppvDEdit)
UninitComControls()
WS_Uninitialize()
ExitApp