Saturday, October 1

My BlogSpot Autolink Uploader

Public Class Form1
Dim repeatcheck As Integer = 0
Dim repeatcheck2 As Integer = 0
Dim Timercount As Integer = 0
Dim Timercount2 As Integer = 0
Dim Timercount3 As Integer = 0
Dim base As String = ""
Dim Total As String = ""
Dim countlink As Integer = 0
Dim htmlcode1 As String = "" <br /> Dim htmlcode6 = " </body></html>"<br /> Private Sub WebBrowser1_DocumentCompleted(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser1.DocumentCompleted <br /> countlink = 0<br /> Dim htmlcode2 As String = " Info related " + TextBox1.Text + " is Below...
"
Dim htmlcode5 = "

"
Dim htmlcode4 As String = "
<- " + TextBox1.Text + "

"
If (repeatcheck = 0) Then
repeatcheck = repeatcheck + 1
My.Computer.FileSystem.WriteAllText("C:\webpage\" + TextBox1.Text + ".htm", htmlcode1 + TextBox1.Text + htmlcode2, True)
Total = Total + htmlcode1 + TextBox1.Text + htmlcode2
End If
Dim link As String
Dim len, lastindex, l1, l3 As Integer
Dim i As Integer
Try
For i = 0 To Me.WebBrowser1.Document.Links.Count - 1 'loop for getting all links
link = WebBrowser1.Document.Links(i).OuterHtml 'getting address of links
len = link.Length
lastindex = link.LastIndexOf("<") 'removing last from text
link = link.Substring(2, lastindex - 1) 'removing from start
len = link.Length
'loop for finding after href=" position for getting address

For l1 = 0 To len - 1
If (link.Substring(l1, 1) = "h") Then
If (link.Substring(l1 + 1, 1) = "r") Then
If (link.Substring(l1 + 2, 1) = "e") Then
If (link.Substring(l1 + 3, 1) = "f") Then
If (link.Substring(l1 + 4, 1) = "=") Then
l3 = l1 + 6
Exit For
End If
End If
End If
End If
End If
Next
len = len - l3 - 1 'getting new length start from address to end
link = link.Substring(l3, len) 'cutting string from address to last
'loop finding string from address to "
For l1 = 0 To len - 1
If (link.Substring(l1, 1) = Chr(34)) Then 'Chr(34) for " character
l3 = l1
Exit For
End If
Next
link = link.Substring(0, l3)
If (link.Substring(0, 1) = "h" And (Not base.Contains(link)) And WebBrowser1.Document.Links(i).InnerText <> "Cached" And (Not link.Contains("google")) And (Not link.Contains("Main?hl")) And (Not link.Contains("results?hl"))) Then
RichTextBox1.Text += vbNewLine + WebBrowser1.Document.Links(i).InnerText
RichTextBox1.Text += vbNewLine + link + vbNewLine
base = htmlcode5 + link + htmlcode3 + WebBrowser1.Document.Links(i).InnerText + htmlcode4
My.Computer.FileSystem.WriteAllText("C:\webpage\" + TextBox1.Text + ".htm", htmlcode5 + link + htmlcode3 + WebBrowser1.Document.Links(i).InnerText + htmlcode4, True)
If (Not Total.Contains(WebBrowser1.Document.Links(i).InnerText)) Then
Total = Total + htmlcode5 + link + htmlcode3 + WebBrowser1.Document.Links(i).InnerText + htmlcode4
End If
countlink = countlink + 1
'getting links text
End If
'cutting address before "
Next
Timer1.Enabled = True

Catch ex As Exception
End Try
End Sub
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
Timercount3 = 0
Timer6.Enabled = False
base = ""
Total = ""
Timercount = 0
repeatcheck = 0
WebBrowser1.Navigate("www.google.co.in/search?hl=in&q=" & TextBox1.Text & "&btnG=Search&meta=")
End If
End Sub
Private Sub WebBrowser2_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser2.DocumentCompleted
Dim link As String
link = ""
Dim htmlcode5 = "

"
Dim htmlcode4 As String = "
<-- " + TextBox1.Text + "

"
Dim len, lastindex, l1, l3 As Integer
Dim i As Integer
Try
For i = 0 To Me.WebBrowser2.Document.Links.Count - 1 'loop for getting all links
link = WebBrowser2.Document.Links(i).OuterHtml 'getting address of links

len = link.Length
lastindex = link.LastIndexOf("<") 'removing last from text
link = link.Substring(2, lastindex - 1) 'removing from start
len = link.Length
'loop for finding after href=" position for getting address

For l1 = 0 To len - 1
If (link.Substring(l1, 1) = "h") Then
If (link.Substring(l1 + 1, 1) = "r") Then
If (link.Substring(l1 + 2, 1) = "e") Then
If (link.Substring(l1 + 3, 1) = "f") Then
If (link.Substring(l1 + 4, 1) = "=") Then
l3 = l1 + 6
Exit For
End If
End If
End If
End If
End If
Next
len = len - l3 - 1 'getting new length start from address to end
link = link.Substring(l3, len) 'cutting string from address to last
'loop finding string from address to "
For l1 = 0 To len - 1
If (link.Substring(l1, 1) = Chr(34)) Then 'Chr(34) for " character
l3 = l1
Exit For
End If
Next
link = link.Substring(0, l3)
If (link.Substring(0, 1) = "h" And (Not base.Contains(link)) And WebBrowser2.Document.Links(i).InnerText <> "Cached" And (Not link.Contains("google")) And (Not link.Contains("Main?hl")) And (Not link.Contains("results?hl"))) Then
RichTextBox1.Text += vbNewLine + WebBrowser2.Document.Links(i).InnerText
RichTextBox1.Text += vbNewLine + link + vbNewLine
base = htmlcode5 + link + htmlcode3 + WebBrowser2.Document.Links(i).InnerText + htmlcode4
My.Computer.FileSystem.WriteAllText("C:\webpage\" + TextBox1.Text + ".htm", base, True)
If (Not Total.Contains(WebBrowser2.Document.Links(i).InnerText)) Then
Total = Total + base
End If
countlink = countlink + 1

'getting links text
End If
'cutting address before "
Next
My.Computer.FileSystem.WriteAllText("C:\webpage\" + TextBox1.Text + ".htm", htmlcode6, True)
RichTextBox2.Text = Total + "-------!!!!!!!!!" + htmlcode6
Label1.Text = "No. of Links are :" + countlink.ToString
RichTextBox2.SelectAll()
RichTextBox2.Copy()
Catch ex As Exception
End Try
If (CheckBox2.CheckState = CheckState.Checked) Then
Try
WebBrowser3.Navigate(TextBox2.Text)
Catch ex As Exception
End Try
End If
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If (repeatcheck2 < 2) Then repeatcheck2 = repeatcheck2 + 1 ElseIf (repeatcheck2 = 2) Then WebBrowser2.Navigate("www.google.co.in/search?q=" & TextBox1.Text & "&hl=en&biw=1467&bih=696&prmd=ivnslb&ei=MeplTpmwM4bqrQfTkrmbCg&start=10&sa=N") Timer1.Enabled = False repeatcheck2 = 0 End If End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick ' My.Computer.Keyboard.SendKeys("{TAB}", True) SendKeys.Send(TextBox1.Text) My.Computer.Keyboard.SendKeys("{TAB}", True) My.Computer.Keyboard.SendKeys("{TAB}", True) My.Computer.Keyboard.SendKeys("{TAB}", True) If (CheckBox3.CheckState = CheckState.Checked) Then Timer3.Enabled = True Timer2.Enabled = False ElseIf (CheckBox3.CheckState = CheckState.Unchecked) Then Timer3.Enabled = False Timer2.Enabled = False SendKeys.Send("^(v)") My.Computer.Keyboard.SendKeys("{TAB}", True) SendKeys.Send(TextBox1.Text) End If End Sub Private Sub WebBrowser3_DocumentCompleted(ByVal sender As System.Object, ByVal e As System.Windows.Forms.WebBrowserDocumentCompletedEventArgs) Handles WebBrowser3.DocumentCompleted WebBrowser3.Focus() If (Timercount3 = 0) Then Timer2.Enabled = True Timercount3 = 1 ElseIf (Timercount3 = 1) Then Timer2.Enabled = False End If End Sub Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick If (Me.Timercount2 = 0) Then SendKeys.Send("^(v)") Timer2.Enabled = False Timercount2 += 1 ElseIf (Me.Timercount2 > 0) Then
Timer4.Enabled = True
End If
End Sub

Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
Timer3.Enabled = False
My.Computer.Keyboard.SendKeys("{TAB}", True)
SendKeys.Send(TextBox1.Text)
Timer5.Enabled = True
Timer4.Enabled = False
End Sub

Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
If (Timercount < 20) Then
My.Computer.Keyboard.SendKeys("{TAB}", True)
Timercount += 1
Else
My.Computer.Keyboard.SendKeys("{Enter}", True)
Timer6.Enabled = True
Timer4.Enabled = False
Timer3.Enabled = False
Timer2.Enabled = False
Timer1.Enabled = False
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
WebBrowser4.Navigate(TextBox3.Text)
End Sub

Private Sub Timer6_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer6.Tick
Timer5.Enabled = False
End Sub
End Class

No comments: