-
Notifications
You must be signed in to change notification settings - Fork 0
/
WS_DEdemo.ahk
190 lines (132 loc) · 3.88 KB
/
WS_DEdemo.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
#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_DEControl.ahk
If (!WS_Initialize("VBScript"))
{
Msgbox % "Error initializing EasyScript"
ExitApp
}
InitComControls()
Gui, +Resize +LastFound
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, xp+140 gNewDocument, New
Gui, Show, w800 h600 Center, DhtmlEdit_Test
hWnd := WinExist()
DEdit := "DEdit"
; Method #1
ppvDEdit := DE_Add(hWnd, 0, 25, 800, 575)
WS_AddObject(ppvDEdit, DEdit)
; Method #2
; If (!WS_Exec("Set %v = CreateObject(%s)", DEdit, "DhtmlEdit.DhtmlEdit"))
; Msgbox % ErrorLevel
; If (!WS_Eval(ppvDEdit, DEdit))
; Msgbox % ErrorLevel
;
; hContainerCtrl := CreateComControlContainer(hWnd, 0, 25, 800, 575)
; AttachComControlToHWND(ppvDEdit, hContainerCtrl)
Gosub, SetDocument
Return ; end of auto-run
SetBold:
DE_SetBold(DEdit)
Return
SetItalic:
DE_SetItalic(DEdit)
Return
SetBlue:
DE_SetForeColor(DEdit, "0000FF")
;DE_SetForeColor(DEdit, "Blue") ; possible way
;DE_SetForeColor(DEdit, "#0000FF") ; also possible
Return
SetUnderline:
DE_SetUnderline(DEdit)
Return
SetImageLink:
DE_SetImage(DEdit)
Return
SetHyperLink:
DE_SetHyperLink(DEdit)
Return
LoadUrl:
url := "http://www.autohotkey.com"
DE_LoadUrl(DEdit, url)
Return
NewDocument:
DE_NewDocument(DEdit)
Return
SaveDocument:
Filedir = %A_ScriptDir%\DhtmlEdit_%A_Now%.htm
DE_SaveDocument(DEdit, FileDir)
Return
GetDocument:
msgbox, % DE_GetDocumentHtml(DEdit)
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 loaded for some reason"
src="http://www.autohotkey.com/docs/images/AutoHotkey_logo.gif"></A></td>
</tr>
</tbody>
</table>
</body>
</html>
)
DE_SetDocumentHtml(DEdit, htmlcode)
htmlcode =
Return
BrowseMode:
DE_BrowseMode(DEdit)
Return
GuiSize:
DE_Move(ppvDEdit, 0, 25, A_GuiWidth, A_GuiHeight - 25)
Return
GuiClose:
Gui, %A_Gui%:Destroy
ReleaseObject(ppvDEdit)
UninitComControls()
WS_Uninitialize()
ExitApp