It says there is a syntax error on this line:
MyHTTPSocket.Get(NthField(htmlsource, Chr(9) 2), fItem)
Here is your code:
Dim htmlsource As String
Dim webversion, thisversion, msgboxresult As Integer
Dim f as FolderItem
Dim MyHTTPSocket As New HTTPSocket
MyHTTPSocket.Yield = True
htmlsource =
MyHTTPSocket.Get("http://4.10.69.244/internetpal/InternetPal.txt", 20)
If htmlsource <> "" Then
webversion = Val(NthField(htmlsource, Chr(9), 1))
thisversion = (App.MajorVersion * 100) + (App.MinorVersion * 10) +
App.BugVersion
If webversion > thisversion Then
msgboxresult = MsgBox("There is a new version available. Would you
like download it?", 4) // displays yes and no buttons in the
//message dialog.
If msgboxresult = 6 Then // User clicked Yes
f = GetSaveFolderItem("", "InternetPal Update")
If f <> Nil Then
//MyHTTPSocket.Get (NthField(htmlsource, Chr(9) 2), f)
MyHTTPSocket.Get(NthField(htmlsource, Chr(9) 2), fItem)
End If
End If
Else
MsgBox "No new version available."
End If
Else
MsgBox "Cannot connect to server."
End If
Brian
On 11/30/04 12:16 PM, "Phil Mobley" <phil at mobleybros dot com> wrote:
> On Nov 29, 2004, at 7:00 PM, Brian Heibert wrote:
>
>> Also I looked for HTTPSocket all I found was TCPSocket
>
> Which version of REALbasic are you using?
>
> Also, there was an error in my code, on this line:
>
> MyHTTPSocket.Get(NthField(htmlsource, Chr(9) 2))
>
> It should be:
>
> MyHTTPSocket.Get(NthField(htmlsource, Chr(9) 2), fItem)
>
> Where fItem is a folderItem where you are going to save the downloaded
> file.
>
> I did leave some things out of the code example that perhaps I should
> not have done. Assuming you have RB 5.5, use this code instead:
>
> Sub CheckForUpdates()
>
> Dim htmlsource As String
> Dim webversion, thisversion, msgboxresult As Integer
> Dim f as FolderItem
> Dim MyHTTPSocket As New HTTPSocket
>
> MyHTTPSocket.Yield = True
> htmlsource =
> MyHTTPSocket.Get("http://4.10.69.244/internetpal/InternetPal.txt", 20)
>
> If htmlsource <> "" Then
> webversion = Val(NthField(htmlsource, Chr(9), 1))
> thisversion = (App.MajorVersion * 100) + (App.MinorVersion * 10) +
> App.BugVersion
>
> If webversion > thisversion Then
> msgboxresult = MsgBox("There is a new version available. Would
> you like download it?", 4) // displays yes and no buttons in the
> message dialog.
> If msgboxresult = 6 Then // User clicked Yes
> f = GetSaveFolderItem("", "MyApp Update")
> If f <> Nil Then
> MyHTTPSocket.Get(NthField(htmlsource, Chr(9) 2), f)
> End If
> End If
> Else
> MsgBox "No new version available."
> End If
> Else
> MsgBox "Cannot connect to server."
> End If
>
> End Sub
>
> NOTE: Setting Yield to true allows your program to continue to
> function like normal. Only when there is a response back from the
> server or the timeout is reached will the rest of the code in *this*
> method process. The only drawback is that the application is unable to
> quit until the response is received or the timeout -- so if you are not
> connected to the internet and decide to quit just after calling
> "CheckForUpdates", the user would need to wait 20 seconds (that is the
> timeout value) before your program "responds" to the quit command.
> This could make your program seem unresponsive during this period.
> There is a complex work-around that I developed, but this entire
> situation is rare (in this case).
>
> There is still more to add in this function, such as checking to see if
> the FolderItem already exists. You can change the name of the
> FolderItem to match the name of the application ignoring what the user
> set as the name in the GetSaveFolderItem dialog. You can even save the
> file directly to the desktop if that is what you prefer to do. There
> are a number of options available.
>
> A couple more points about the version number. The system set up above
> only allows for version numbers between 1.0.0 and 9.9.9. Also there is
> no difference between a release version and a beta version. You can
> extend the available version numbers like this:
>
> thisversion = (App.MajorVersion * 10000000) + (App.MinorVersion *
> 100000) + (App.BugVersion * 1000) + (App.StageCode * 100) +
> App.NonReleaseVersion
>
> This would treat "2.1.1b15" as a earlier version to "2.1.1" (final
> release). Then the maximum allowable version is:
>
> 99.99.99x99
>
> where x is the shorthand for the development stage, "d" for
> development, "a" for alpha, "b" for beta and "r" for release.
>
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives of this list here:
> <http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|