|
| 1 | +VERSION 5.00 |
| 2 | +Object = "{48E59290-9880-11CF-9754-00AA00C00908}#1.0#0"; "MSINET.OCX" |
| 3 | +Begin VB.Form Form1 |
| 4 | + Caption = "Dictionary Search" |
| 5 | + ClientHeight = 1635 |
| 6 | + ClientLeft = 60 |
| 7 | + ClientTop = 345 |
| 8 | + ClientWidth = 2880 |
| 9 | + Icon = "Form1.frx":0000 |
| 10 | + LinkTopic = "Form1" |
| 11 | + MaxButton = 0 'False |
| 12 | + ScaleHeight = 1635 |
| 13 | + ScaleWidth = 2880 |
| 14 | + StartUpPosition = 2 'CenterScreen |
| 15 | + Begin VB.TextBox Text |
| 16 | + Height = 885 |
| 17 | + Left = 0 |
| 18 | + MultiLine = -1 'True |
| 19 | + ScrollBars = 3 'Both |
| 20 | + TabIndex = 2 |
| 21 | + Top = 600 |
| 22 | + Visible = 0 'False |
| 23 | + Width = 2535 |
| 24 | + End |
| 25 | + Begin InetCtlsObjects.Inet Inet1 |
| 26 | + Left = 3240 |
| 27 | + Top = 1320 |
| 28 | + _ExtentX = 1005 |
| 29 | + _ExtentY = 1005 |
| 30 | + _Version = 393216 |
| 31 | + End |
| 32 | + Begin VB.TextBox Text1 |
| 33 | + Appearance = 0 'Flat |
| 34 | + BackColor = &H000000C0& |
| 35 | + ForeColor = &H00FFFFFF& |
| 36 | + Height = 285 |
| 37 | + Left = 0 |
| 38 | + TabIndex = 1 |
| 39 | + Text = "firewall" |
| 40 | + Top = 0 |
| 41 | + Width = 2655 |
| 42 | + End |
| 43 | + Begin VB.Image Image1 |
| 44 | + Height = 480 |
| 45 | + Left = 2160 |
| 46 | + Picture = "Form1.frx":1272 |
| 47 | + Top = 300 |
| 48 | + Visible = 0 'False |
| 49 | + Width = 465 |
| 50 | + End |
| 51 | + Begin VB.Label Label1 |
| 52 | + Appearance = 0 'Flat |
| 53 | + BackColor = &H000000C0& |
| 54 | + BorderStyle = 1 'Fixed Single |
| 55 | + ForeColor = &H00FFFFFF& |
| 56 | + Height = 1095 |
| 57 | + Left = 0 |
| 58 | + TabIndex = 0 |
| 59 | + Top = 300 |
| 60 | + Width = 2655 |
| 61 | + End |
| 62 | +End |
| 63 | +Attribute VB_Name = "Form1" |
| 64 | +Attribute VB_GlobalNameSpace = False |
| 65 | +Attribute VB_Creatable = False |
| 66 | +Attribute VB_PredeclaredId = True |
| 67 | +Attribute VB_Exposed = False |
| 68 | +'''''''''''''''''''''''''''''' |
| 69 | +''''''SubZero DeZignS''''''''' |
| 70 | +'''''''''''''''''''''''''''''' |
| 71 | + |
| 72 | +Option Explicit |
| 73 | +Dim Search As String |
| 74 | +Dim Second As String |
| 75 | +Dim spot As Integer |
| 76 | +Dim spot2 As Integer |
| 77 | +Dim done As String, done2 As String |
| 78 | +Dim beginspot As Integer, EndSpot As Integer |
| 79 | + |
| 80 | +Sub GetString(word As String) |
| 81 | +On Error Resume Next |
| 82 | +' Here is where we open the connection to the said site with Inet control |
| 83 | +Text1.Text = Trim(Text1.Text) |
| 84 | +Inet1.URL = "http://encarta.msn.com/dictionary_/" & Text1.Text & ".html" |
| 85 | +' Now we dump the text of the said site into the Text box |
| 86 | +Text = Inet1.OpenURL(Inet1.URL) |
| 87 | +' Now we call upon our first string parser |
| 88 | +GetDefinition |
| 89 | +End Sub |
| 90 | + |
| 91 | +Sub GetDefinition() |
| 92 | +'We start by going down the rows for the parsing. |
| 93 | +On Error GoTo Err |
| 94 | +Search = "CORE MEANING:" |
| 95 | +spot = InStr(Text, "CORE MEANING:") |
| 96 | +done = Mid(Text, spot - 2, spot) |
| 97 | +spot2 = InStr(done, "<br />") |
| 98 | +done = Mid(done, 1, spot2 - 1) |
| 99 | +'Replace Begin |
| 100 | +done = pReplace(Trim(done), "CORE MEANING:", "CORE MEANING: ") |
| 101 | +done = pReplace(Trim(done), ">", "") |
| 102 | +done = Trim(done) |
| 103 | +'Parser Finish 'Replace Finish |
| 104 | +'Dump into Label for Viewing. |
| 105 | +Label1 = done |
| 106 | +Exit Sub |
| 107 | +Err: |
| 108 | +' If that parser was not quite hitting the spot we call upon the next string parser |
| 109 | +Alternate |
| 110 | +Exit Sub |
| 111 | +End Sub |
| 112 | + |
| 113 | +Sub Alternate() |
| 114 | +'As you see I named this one Alternative. This one will get a string that closely matches your word match |
| 115 | +On Error GoTo Err |
| 116 | +spot = InStr(Text, "but we found the following alternate spellings for you.") |
| 117 | +done = Mid(Text, spot, spot) |
| 118 | +spot2 = InStr(done, "Search all of MSN Encarta for") |
| 119 | +done = Mid(done, 1, spot2 - 1) |
| 120 | +'Replace Begin |
| 121 | +done = pReplace(Trim(done), "but we found the following alternate spellings for you.", "Alternate: ") |
| 122 | +done = pReplace(Trim(done), "Click one to continue your search.", "") |
| 123 | +done = pReplace(Trim(done), "</td>", "") |
| 124 | +done = pReplace(Trim(done), "</tr>", "") |
| 125 | +done = pReplace(Trim(done), """", "") |
| 126 | +done = pReplace(Trim(done), "<tr height=", "") |
| 127 | +done = pReplace(Trim(done), "16>", "") |
| 128 | +done = pReplace(Trim(done), "<td height=", "") |
| 129 | +done = pReplace(Trim(done), "<tr><td class=", "") |
| 130 | +done = pReplace(Trim(done), "class=", "") |
| 131 | +done = pReplace(Trim(done), "NoResultsSuggestions", "") |
| 132 | +done = pReplace(Trim(done), "<a href=", "") |
| 133 | +done = pReplace(Trim(done), "/dictionary_/", "") |
| 134 | +done = pReplace(Trim(done), """", "") |
| 135 | +done = pReplace(Trim(done), ".html>", " ") |
| 136 | +done = pReplace(Trim(done), "</a>", " ") |
| 137 | +done = pReplace(Trim(done), "10>", "") |
| 138 | +done = pReplace(Trim(done), "10>", "") |
| 139 | +done = pReplace(Trim(done), "SearchAll>", "") |
| 140 | +done = pReplace(Trim(done), ">", "") |
| 141 | +done = pReplace(Trim(done), "", "") |
| 142 | +done = pReplace(Trim(done), "", "") |
| 143 | +done = Trim(done) |
| 144 | +'Parser Finish 'Replace Finish |
| 145 | +'Dump into Label for Viewing. |
| 146 | +Label1 = done |
| 147 | +Exit Sub |
| 148 | +Err: |
| 149 | +Alternative2 |
| 150 | +Exit Sub |
| 151 | +End Sub |
| 152 | + |
| 153 | +Sub Alternative2() |
| 154 | +'This one is for strings that contain more then one definition |
| 155 | +'If you want. you could put more into the parser like spot = InStr(Text, "3. ") and start another string. |
| 156 | +'Remembering to change the String qualifier. "done, done2, done3" ext' |
| 157 | +On Error GoTo Err |
| 158 | +spot = InStr(Text, ">1. ") |
| 159 | +done = Mid(Text, spot, spot) |
| 160 | +spot2 = InStr(done, "<br />") |
| 161 | +done = Mid(done, 1, spot2 - 1) |
| 162 | +done = pReplace(Trim(done), "", "") |
| 163 | +done = pReplace(Trim(done), " ", " ") |
| 164 | +done = pReplace(Trim(done), "</b>", "") |
| 165 | +done = pReplace(Trim(done), "<b>", "") |
| 166 | +done = pReplace(Trim(done), "<span", "") |
| 167 | +done = pReplace(Trim(done), "ResultBody", "") |
| 168 | +done = pReplace(Trim(done), "SmallCaps", "") |
| 169 | +done = pReplace(Trim(done), "</span>", "") |
| 170 | +done = pReplace(Trim(done), "(", "") |
| 171 | +done = pReplace(Trim(done), ")", "") |
| 172 | +done = pReplace(Trim(done), "</td>", "") |
| 173 | +done = pReplace(Trim(done), "</tr>", "") |
| 174 | +done = pReplace(Trim(done), """", "") |
| 175 | +done = pReplace(Trim(done), "<tr height=", "") |
| 176 | +done = pReplace(Trim(done), "16>", "") |
| 177 | +done = pReplace(Trim(done), "<td height=", "") |
| 178 | +done = pReplace(Trim(done), "<tr><td class=", "") |
| 179 | +done = pReplace(Trim(done), "class=", "") |
| 180 | +done = pReplace(Trim(done), "NoResultsSuggestions", "") |
| 181 | +done = pReplace(Trim(done), "<a href=", "") |
| 182 | +done = pReplace(Trim(done), "/dictionary_/", "") |
| 183 | +done = pReplace(Trim(done), """", "") |
| 184 | +done = pReplace(Trim(done), ".html>", " ") |
| 185 | +done = pReplace(Trim(done), "</a>", " ") |
| 186 | +done = pReplace(Trim(done), "10>", "") |
| 187 | +done = pReplace(Trim(done), "10>", "") |
| 188 | +done = pReplace(Trim(done), "SearchAll>", "") |
| 189 | +done = pReplace(Trim(done), "<i>", "") |
| 190 | +done = pReplace(Trim(done), "</i>", "") |
| 191 | +done = pReplace(Trim(done), vbCrLf, " ") |
| 192 | +done = pReplace(Trim(done), ">", "") |
| 193 | +done = pReplace(Trim(done), Chr(10), " ") |
| 194 | +done = pReplace(Trim(done), Chr(13), " ") |
| 195 | +done = pReplace(Trim(done), Chr(13), "") |
| 196 | +done = pReplace(Trim(done), Chr(13), "") |
| 197 | +done = pReplace(Trim(done), Chr(13), "") |
| 198 | +done = pReplace(Trim(done), Chr(13), "") |
| 199 | +done = pReplace(Trim(done), Chr(10), "") |
| 200 | +done = pReplace(Trim(done), Chr(10), "") |
| 201 | +done = pReplace(Trim(done), Chr(10), "") |
| 202 | + |
| 203 | +'Second Definitions start here. |
| 204 | +spot = InStr(spot, Text, ">2. ") |
| 205 | +done2 = Mid(Text, spot, spot) |
| 206 | +spot2 = InStr(done2, "<br />") |
| 207 | +done2 = Mid(done2, 1, spot2 - 1) |
| 208 | +done2 = pReplace(Trim(done2), "", "") |
| 209 | +done2 = pReplace(Trim(done2), " ", " ") |
| 210 | +done2 = pReplace(Trim(done2), "</b>", "") |
| 211 | +done2 = pReplace(Trim(done2), "<b>", "") |
| 212 | +done2 = pReplace(Trim(done2), "<span", "") |
| 213 | +done2 = pReplace(Trim(done2), "ResultBody", "") |
| 214 | +done2 = pReplace(Trim(done2), "SmallCaps", "") |
| 215 | +done2 = pReplace(Trim(done2), "</span>", "") |
| 216 | +done2 = pReplace(Trim(done2), "(", "") |
| 217 | +done2 = pReplace(Trim(done2), ")", "") |
| 218 | +done2 = pReplace(Trim(done2), "</td>", "") |
| 219 | +done2 = pReplace(Trim(done2), "</tr>", "") |
| 220 | +done2 = pReplace(Trim(done2), """", "") |
| 221 | +done2 = pReplace(Trim(done2), "<tr height=", "") |
| 222 | +done2 = pReplace(Trim(done2), "16>", "") |
| 223 | +done2 = pReplace(Trim(done2), "<td height=", "") |
| 224 | +done2 = pReplace(Trim(done2), "<tr><td class=", "") |
| 225 | +done2 = pReplace(Trim(done2), "class=", "") |
| 226 | +done2 = pReplace(Trim(done2), "NoResultsSuggestions", "") |
| 227 | +done2 = pReplace(Trim(done2), "<a href=", "") |
| 228 | +done2 = pReplace(Trim(done2), "/dictionary_/", "") |
| 229 | +done2 = pReplace(Trim(done2), """", "") |
| 230 | +done2 = pReplace(Trim(done2), ".html>", " ") |
| 231 | +done2 = pReplace(Trim(done2), "</a>", " ") |
| 232 | +done2 = pReplace(Trim(done2), "10>", "") |
| 233 | +done2 = pReplace(Trim(done2), "10>", "") |
| 234 | +done2 = pReplace(Trim(done2), "SearchAll>", "") |
| 235 | +done2 = pReplace(Trim(done2), "<i>", "") |
| 236 | +done2 = pReplace(Trim(done2), "</i>", "") |
| 237 | +done2 = pReplace(Trim(done2), ">", "") |
| 238 | +done2 = Trim(done2) |
| 239 | +Label1 = done & vbCrLf & done2 |
| 240 | +Exit Sub |
| 241 | +Err: |
| 242 | +Alternative3 |
| 243 | +Exit Sub |
| 244 | +End Sub |
| 245 | + |
| 246 | +Sub Alternative3() |
| 247 | +'This ones for such language MSN doesn't allow. |
| 248 | +On Error GoTo Err |
| 249 | +'Looks for the Word string. if it returns Language Advisory |
| 250 | +'Then I +'ed it 17 for putting that word string back into the label for visual conformation. |
| 251 | +spot = InStr(Text, "Language Advisory") |
| 252 | +done = Mid(Text, spot, spot) |
| 253 | +spot2 = InStr(done, "Language Advisory") + 17 |
| 254 | +done = Mid(done, 1, spot2 - 1) |
| 255 | +done = pReplace(Trim(done), "", "") |
| 256 | +done = Trim(done) |
| 257 | +Label1 = done |
| 258 | +Exit Sub |
| 259 | +Err: |
| 260 | +'And if all else fails. There's probably no more definitions to parse for the word |
| 261 | +Label1 = "No Matches found. Retry another Word or shorten it." |
| 262 | +Exit Sub |
| 263 | +End Sub |
| 264 | + |
| 265 | +Private Sub Form_Load() |
| 266 | +Form1.Height = 2800 |
| 267 | +Form1.Width = 3800 |
| 268 | +End Sub |
| 269 | + |
| 270 | +Private Sub Form_Resize() |
| 271 | +Text1.Width = Form1.Width |
| 272 | +Label1.Width = Form1.Width |
| 273 | +Label1.Height = Form1.Height - Text1.Height |
| 274 | +End Sub |
| 275 | + |
| 276 | +Private Sub Label1_Change() |
| 277 | +If Label1.Caption = "Language Advisory" Then Image1.Visible = True |
| 278 | +End Sub |
| 279 | + |
| 280 | +Private Sub Text1_KeyPress(KeyAscii As Integer) |
| 281 | +'If they pressed the Enter/Return key |
| 282 | +If KeyAscii = vbKeyReturn Then |
| 283 | +KeyAscii = 0 |
| 284 | +Inet1.Cancel |
| 285 | +Label1.Caption = "Connecting. -" |
| 286 | +Image1.Visible = False |
| 287 | +Text.Text = "" |
| 288 | +GetString Text1.Text |
| 289 | +done = pReplace(Trim(done), "", "") |
| 290 | +End If |
| 291 | +End Sub |
0 commit comments