Author | Message | Time |
---|---|---|
WiLD | Hi, i was wondering how you read a txt file off the net though vb. Example: www.blah.com/blah/version.txt contains "please update at......" when u click a button it displays whats in version.txt and mayb it has 2 match to continue. So when you start your bot it reads the URL and u enter a id key, if it doesnt match one of them at the url it doesnt let you continue. Thx | July 3, 2003, 5:40 AM |
SNiFFeR | You can use Inet. (Microsoft Internet Transfer Controls 6, (MSINET.OCX)) :-\ Using the Inet1.openurl("http://www.yoursite.com/version.txt") | July 3, 2003, 6:29 AM |
Smurfling | If you are talking about VB .NET this would be a example to get the data from every file you specify: [code] Dim WC As System.Net.WebClient = New System.Net.WebClient() Dim link As String = "http://www.blah.de/mooh.txt" Dim response As System.IO.Stream = WC.OpenRead(link) Dim WCReader As System.IO.StreamReader = New System.IO.StreamReader(response, System.Text.Encoding.ASCII) Dim WCResponse As String = WCReader.ReadToEnd() [/code] WCResponse (String) will contain the data from the file specified with link(String) | July 3, 2003, 11:43 AM |
WiLD | No its just plain old VB6, thx neway. Thx sniffer, how would i got about doing; if http://www.mysite.com/version.txt contains the words "New Version" it opens iexplorer and takes you to the download site. I dont no how 2 do it so if it contains "New Version" | July 3, 2003, 3:31 PM |
DarkMod | IMO that probably isn't a good idea, forcing popups, and downloading on a program isn't always a good idea. You can always add an check for update button, that will compare your version to the one on a file server, and just update it (there is a source of pscode.com that teaches you how to do it I believe). That would probably be your best idea, because in all likelyhood if you have the words "New" and "Version" anywhere in that text file its going to take you to that website. So save yourself some time, and Trouble. :) -DMod | July 3, 2003, 3:45 PM |
SNiFFeR | You could use an if then statement comparing your text to the text on the web site. Then after doing that you could use "ShellExecute" and open IE and go directly to that file. | July 3, 2003, 9:00 PM |
Camel | [code]Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long ... URL = URL & _ "?ver1=" & App.Major & _ "&ver2=" & App.Minor & _ "&ver3=" & App.Revision ... frmSetup.Inet1.Execute URL While frmSetup.Inet1.StillExecuting Sleep 100 DoEvents Wend Dim resp As String resp = frmSetup.Inet1.GetChunk(10240) 'should be plenty of space ... ShellExecute 0, "open", Q, "", "", 5 'Q is a string containing a URL to the update ...[/code] | July 3, 2003, 10:09 PM |