-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathForm1.frm
More file actions
291 lines (280 loc) · 9.41 KB
/
Form1.frm
File metadata and controls
291 lines (280 loc) · 9.41 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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
VERSION 5.00
Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX"
Begin VB.Form Form1
Caption = "Dictionary Search"
ClientHeight = 1635
ClientLeft = 60
ClientTop = 345
ClientWidth = 2880
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 1635
ScaleWidth = 2880
StartUpPosition = 2 'CenterScreen
Begin VB.TextBox Text
Height = 885
Left = 0
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 2
Top = 600
Visible = 0 'False
Width = 2535
End
Begin InetCtlsObjects.Inet Inet1
Left = 3240
Top = 1320
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H000000C0&
ForeColor = &H00FFFFFF&
Height = 285
Left = 0
TabIndex = 1
Text = "firewall"
Top = 0
Width = 2655
End
Begin VB.Image Image1
Height = 480
Left = 2160
Picture = "Form1.frx":1272
Top = 300
Visible = 0 'False
Width = 465
End
Begin VB.Label Label1
Appearance = 0 'Flat
BackColor = &H000000C0&
BorderStyle = 1 'Fixed Single
ForeColor = &H00FFFFFF&
Height = 1095
Left = 0
TabIndex = 0
Top = 300
Width = 2655
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
''''''''''''''''''''''''''''''
''''''SubZero DeZignS'''''''''
''''''''''''''''''''''''''''''
Option Explicit
Dim Search As String
Dim Second As String
Dim spot As Integer
Dim spot2 As Integer
Dim done As String, done2 As String
Dim beginspot As Integer, EndSpot As Integer
Sub GetString(word As String)
On Error Resume Next
' Here is where we open the connection to the said site with Inet control
Text1.Text = Trim(Text1.Text)
Inet1.URL = "http://encarta.msn.com/dictionary_/" & Text1.Text & ".html"
' Now we dump the text of the said site into the Text box
Text = Inet1.OpenURL(Inet1.URL)
' Now we call upon our first string parser
GetDefinition
End Sub
Sub GetDefinition()
'We start by going down the rows for the parsing.
On Error GoTo Err
Search = "CORE MEANING:"
spot = InStr(Text, "CORE MEANING:")
done = Mid(Text, spot - 2, spot)
spot2 = InStr(done, "<br />")
done = Mid(done, 1, spot2 - 1)
'Replace Begin
done = pReplace(Trim(done), "CORE MEANING:", "CORE MEANING: ")
done = pReplace(Trim(done), ">", "")
done = Trim(done)
'Parser Finish 'Replace Finish
'Dump into Label for Viewing.
Label1 = done
Exit Sub
Err:
' If that parser was not quite hitting the spot we call upon the next string parser
Alternate
Exit Sub
End Sub
Sub Alternate()
'As you see I named this one Alternative. This one will get a string that closely matches your word match
On Error GoTo Err
spot = InStr(Text, "but we found the following alternate spellings for you.")
done = Mid(Text, spot, spot)
spot2 = InStr(done, "Search all of MSN Encarta for")
done = Mid(done, 1, spot2 - 1)
'Replace Begin
done = pReplace(Trim(done), "but we found the following alternate spellings for you.", "Alternate: ")
done = pReplace(Trim(done), "Click one to continue your search.", "")
done = pReplace(Trim(done), "</td>", "")
done = pReplace(Trim(done), "</tr>", "")
done = pReplace(Trim(done), """", "")
done = pReplace(Trim(done), "<tr height=", "")
done = pReplace(Trim(done), "16>", "")
done = pReplace(Trim(done), "<td height=", "")
done = pReplace(Trim(done), "<tr><td class=", "")
done = pReplace(Trim(done), "class=", "")
done = pReplace(Trim(done), "NoResultsSuggestions", "")
done = pReplace(Trim(done), "<a href=", "")
done = pReplace(Trim(done), "/dictionary_/", "")
done = pReplace(Trim(done), """", "")
done = pReplace(Trim(done), ".html>", " ")
done = pReplace(Trim(done), "</a>", " ")
done = pReplace(Trim(done), "10>", "")
done = pReplace(Trim(done), "10>", "")
done = pReplace(Trim(done), "SearchAll>", "")
done = pReplace(Trim(done), ">", "")
done = pReplace(Trim(done), "", "")
done = pReplace(Trim(done), "", "")
done = Trim(done)
'Parser Finish 'Replace Finish
'Dump into Label for Viewing.
Label1 = done
Exit Sub
Err:
Alternative2
Exit Sub
End Sub
Sub Alternative2()
'This one is for strings that contain more then one definition
'If you want. you could put more into the parser like spot = InStr(Text, "3. ") and start another string.
'Remembering to change the String qualifier. "done, done2, done3" ext'
On Error GoTo Err
spot = InStr(Text, ">1. ")
done = Mid(Text, spot, spot)
spot2 = InStr(done, "<br />")
done = Mid(done, 1, spot2 - 1)
done = pReplace(Trim(done), "", "")
done = pReplace(Trim(done), " ", " ")
done = pReplace(Trim(done), "</b>", "")
done = pReplace(Trim(done), "<b>", "")
done = pReplace(Trim(done), "<span", "")
done = pReplace(Trim(done), "ResultBody", "")
done = pReplace(Trim(done), "SmallCaps", "")
done = pReplace(Trim(done), "</span>", "")
done = pReplace(Trim(done), "(", "")
done = pReplace(Trim(done), ")", "")
done = pReplace(Trim(done), "</td>", "")
done = pReplace(Trim(done), "</tr>", "")
done = pReplace(Trim(done), """", "")
done = pReplace(Trim(done), "<tr height=", "")
done = pReplace(Trim(done), "16>", "")
done = pReplace(Trim(done), "<td height=", "")
done = pReplace(Trim(done), "<tr><td class=", "")
done = pReplace(Trim(done), "class=", "")
done = pReplace(Trim(done), "NoResultsSuggestions", "")
done = pReplace(Trim(done), "<a href=", "")
done = pReplace(Trim(done), "/dictionary_/", "")
done = pReplace(Trim(done), """", "")
done = pReplace(Trim(done), ".html>", " ")
done = pReplace(Trim(done), "</a>", " ")
done = pReplace(Trim(done), "10>", "")
done = pReplace(Trim(done), "10>", "")
done = pReplace(Trim(done), "SearchAll>", "")
done = pReplace(Trim(done), "<i>", "")
done = pReplace(Trim(done), "</i>", "")
done = pReplace(Trim(done), vbCrLf, " ")
done = pReplace(Trim(done), ">", "")
done = pReplace(Trim(done), Chr(10), " ")
done = pReplace(Trim(done), Chr(13), " ")
done = pReplace(Trim(done), Chr(13), "")
done = pReplace(Trim(done), Chr(13), "")
done = pReplace(Trim(done), Chr(13), "")
done = pReplace(Trim(done), Chr(13), "")
done = pReplace(Trim(done), Chr(10), "")
done = pReplace(Trim(done), Chr(10), "")
done = pReplace(Trim(done), Chr(10), "")
'Second Definitions start here.
spot = InStr(spot, Text, ">2. ")
done2 = Mid(Text, spot, spot)
spot2 = InStr(done2, "<br />")
done2 = Mid(done2, 1, spot2 - 1)
done2 = pReplace(Trim(done2), "", "")
done2 = pReplace(Trim(done2), " ", " ")
done2 = pReplace(Trim(done2), "</b>", "")
done2 = pReplace(Trim(done2), "<b>", "")
done2 = pReplace(Trim(done2), "<span", "")
done2 = pReplace(Trim(done2), "ResultBody", "")
done2 = pReplace(Trim(done2), "SmallCaps", "")
done2 = pReplace(Trim(done2), "</span>", "")
done2 = pReplace(Trim(done2), "(", "")
done2 = pReplace(Trim(done2), ")", "")
done2 = pReplace(Trim(done2), "</td>", "")
done2 = pReplace(Trim(done2), "</tr>", "")
done2 = pReplace(Trim(done2), """", "")
done2 = pReplace(Trim(done2), "<tr height=", "")
done2 = pReplace(Trim(done2), "16>", "")
done2 = pReplace(Trim(done2), "<td height=", "")
done2 = pReplace(Trim(done2), "<tr><td class=", "")
done2 = pReplace(Trim(done2), "class=", "")
done2 = pReplace(Trim(done2), "NoResultsSuggestions", "")
done2 = pReplace(Trim(done2), "<a href=", "")
done2 = pReplace(Trim(done2), "/dictionary_/", "")
done2 = pReplace(Trim(done2), """", "")
done2 = pReplace(Trim(done2), ".html>", " ")
done2 = pReplace(Trim(done2), "</a>", " ")
done2 = pReplace(Trim(done2), "10>", "")
done2 = pReplace(Trim(done2), "10>", "")
done2 = pReplace(Trim(done2), "SearchAll>", "")
done2 = pReplace(Trim(done2), "<i>", "")
done2 = pReplace(Trim(done2), "</i>", "")
done2 = pReplace(Trim(done2), ">", "")
done2 = Trim(done2)
Label1 = done & vbCrLf & done2
Exit Sub
Err:
Alternative3
Exit Sub
End Sub
Sub Alternative3()
'This ones for such language MSN doesn't allow.
On Error GoTo Err
'Looks for the Word string. if it returns Language Advisory
'Then I +'ed it 17 for putting that word string back into the label for visual conformation.
spot = InStr(Text, "Language Advisory")
done = Mid(Text, spot, spot)
spot2 = InStr(done, "Language Advisory") + 17
done = Mid(done, 1, spot2 - 1)
done = pReplace(Trim(done), "", "")
done = Trim(done)
Label1 = done
Exit Sub
Err:
'And if all else fails. There's probably no more definitions to parse for the word
Label1 = "No Matches found. Retry another Word or shorten it."
Exit Sub
End Sub
Private Sub Form_Load()
Form1.Height = 2800
Form1.Width = 3800
End Sub
Private Sub Form_Resize()
Text1.Width = Form1.Width
Label1.Width = Form1.Width
Label1.Height = Form1.Height - Text1.Height
End Sub
Private Sub Label1_Change()
If Label1.Caption = "Language Advisory" Then Image1.Visible = True
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
'If they pressed the Enter/Return key
If KeyAscii = vbKeyReturn Then
KeyAscii = 0
Inet1.Cancel
Label1.Caption = "Connecting. -"
Image1.Visible = False
Text.Text = ""
GetString Text1.Text
done = pReplace(Trim(done), "", "")
End If
End Sub