User talk:Automation Talk

Imports System Imports System.Text Imports Microsoft.VisualBasic.Strings ' _ '" ' utf8 = New UTF8Encoding 'Open App 'Dim Window,strXMLURL set Window = CreateObject("InternetExplorer.Application") 'Window.RegisterAsBrowser = True 'strFolderName ="C:\Users\Upasana\Desktop\error.xml" strXMLURL ="C:\Users\Upasana\Desktop\error.xml" Window.Navigate(strXMLURL)

html = web.DownloadData(strXMLURL) resultHtml = utf8.GetString(html) If Instr(UCASE(resultHtml),UCASE(".*XML Page cannot be displayed.*")>0) Then ValidateXML=False else 'Dim startIndex As Integer = resultHtml.IndexOf(SEARCH_STRING_BEGIN, 0) '  Dim endIndex As Integer = resultHtml.IndexOf(SEARCH_STRING_END, startIndex) ' Dim lenght As Integer = endIndex - startIndex - SEARCH_STRING_BEGIN.Length

TagName = resultHtml.Substring(startIndex + SEARCH_STRING_BEGIN.Length, lenght) If Instr(tagName,".*XML version.*")>0 Then ValidateXML= True End If End if       'Find IP

End Function

'Select Folder Option Explicit Dim Window,strXMLURL,strFolderName Dim WshShell, runCmd Dim Stuff, myFSO, WriteStuff, dateStamp Set WshShell = CreateObject("WScript.Shell") strFolderName ="C:\Users\Upasana\Desktop\error.xml" runCmd = "EXPLORER.exe /select," & strXMLURL WshShell.run runCmd Set WshShell = Nothing

'Open App 'Dim Window,strXMLURL set Window = CreateObject("InternetExplorer.Application") 'Window.RegisterAsBrowser = True 'strFolderName ="C:\Users\Upasana\Desktop\error.xml" strXMLURL ="www.google.com" Window.Navigate(strXMLURL) 'Window.Navigate(strFolderName) 'Window.GetProperty("innertext")

Set wshshell=CreateObject("wscript.shell") wshshell.sendkeys "{F5}"

'Open up the path to save the information into a text file 'Dim Stuff, myFSO, WriteStuff, dateStamp dateStamp = Date

'Write information to Text File Replace dateStamp,"#","" Stuff = "Whatever you want written" & dateStamp

Set myFSO = CreateObject("Scripting.FileSystemObject") Set WriteStuff = myFSO.OpenTextFile("yourtextfile.txt", 8, True) WriteStuff.WriteLine(Stuff) WriteStuff.Close SET WriteStuff = NOTHING SET myFSO = NOTHING

'Window.MenuBar = True 'Window.ToolBar = True 'Window.AddressBar = True 'Window.StatusBar = True 'Window.FullScreen = False 'Window.Resizable = True 'Window.Visible = True 'Window.Width = 850 'Window.Height = 720

ValidateXML

Private Const IP_SERVICE_URL = "http://www.whatismyip.com" Private Const SEARCH_STRING_BEGIN = " Your IP Is " Private Const SEARCH_STRING_END = " "

Public Shared Function GetIP As String 'Open App 'Dim Window,strXMLURL set Window = CreateObject("InternetExplorer.Application") 'Window.RegisterAsBrowser = True 'strFolderName ="C:\Users\Upasana\Desktop\error.xml" strXMLURL ="www.google.com" Window.Navigate(strXMLURL)

Dim web As New WebClient Dim html As Byte Dim resultHtml As String

Dim utf8 As New UTF8Encoding html = web.DownloadData(IP_SERVICE_URL) resultHtml = utf8.GetString(html)

'Find IP       Dim startIndex As Integer = resultHtml.IndexOf(SEARCH_STRING_BEGIN, 0) Dim endIndex As Integer = resultHtml.IndexOf(SEARCH_STRING_END, startIndex) Dim lenght As Integer = endIndex - startIndex - SEARCH_STRING_BEGIN.Length

Return resultHtml.Substring(startIndex + SEARCH_STRING_BEGIN.Length, lenght)