|
05-30-02
Version Tracking by
Erick Tejkowski
Ever wonder how REALbasic programmers implement the "Check for Updates" feature found in so many apps today? This week we'll look at a simple
example of how to do this.
Build the Interface
Launch REALbasic and open Window1. To this window, add a PushButton, an EditField, a StaticText control,
a ChasingArrows control, and a Socket. Change the properties of each to match the following table:
| Control Type | Name | Other Info |
| EditField | EditField1 | |
| PushButton | PushButton1 | Caption = "Check Version" |
| Socket | httpSocket1 | super = "httpSocket" |
Notice that you don't have an httpSocket in your project yet. If you want to follow along, download the
httpSocket from Dan Vanderkam and drag the httpSocket class into your project.
Then go back and change the Super property of the httpSocket1 to httpSocket. If you don't feel like
finding the parts, you can download the completed project at the end of this tutorial.
Arrange the interface to your liking. For example, it might look like this:
Source Code
Double click PushButton1 to open the Code Editor and add the following code to its Action event:
dim theURL as string
// a sample version-number-file on the resex server
theURL = "http://www.resexcellence.com/realbasic/downloads_02/05-30-02_version.txt"
// Display the ChasingArrows
// to show we are at work
ChasingArrows1.visible = TRUE
// Prep the Socket and get the file (as a variable)
// The resulting variable will be available in the
// DLFinished event of httpSocket1
httpSocket1.httpSocket
httpSocket1.storeInFile=true
httpSocket1.Method = 1
theURL = httpSocket1.FormatURL(theURL)
httpSocket1.GetFile(theURL)
Finally, navigate to the DLFinished event of httpSocket1 and add this code:
dim myversion as integer
statictext1.text=txt
myversion=val(editfield1.text)
// Hide the ChasingArrows
// to show we are at finished
ChasingArrows1.visible = FALSE
if val(txt)>myversion then
MsgBox "You need to update!"
elseif val(txt)<myversion then
MsgBox "Your version is newer than the currently available version!"
else
MsgBox "Your software is current."
end if
Conclusion
That's it...short and sweet. The code downloads a file I've placed on the Resex server which holds a version number. Once downloaded, we simply
compare the version number that is in that text file with the version number we've designated for this application. Then, we display an
appropriate message. You can download the finished project here.
See you next week!
5-28-02
REALbasic News
by
Erick Tejkowski
DrawControl and Custom Icon
Francis Lessard has posted two new REALbasic plugins: DrawControl 1.0 and Custom Icon 1.0.
Find more information here.
LetsSee for OS X
Irony software announced that its popular graphics browser
LetsSee is now available for OS X.
The most recent version; 1.8.2 has been
ported to Applešs super-modern operating system: Mac OS X.
LetsSee is a graphics browser that gives you fast and easy
access to your favorite pictures and movies, flash and mp3 files. You can
edit and save your images. You can modify and batch change file properties
like name, file-comment and creator. Present your media files as a
continuous slideshow and create a html photo gallery and a lot more. Made with REALbasic!
Office Constants
Check out these new modules
for encapsulating all of the constants that can be used in VBA in conjunction with the REALbasic Office Automation plugins.
- Excel Constants
- MSOLib Constants
- Powerpoint Constants
- VBA Constants
- Word Constants
Drag the modules you want to use into your project and you will have access to the constants from those modules.
Pigmy
Are you a Pixie user? If so, check out Pigmy from Seth Willits.
PodUtil 1.0b3
KennettNet are pleased to announce the release of PodUtil 1.0b3 for Mac OS
8.5 - 9.x.x and for Mac OS X. This is an update to the already popular
program and is still in beta, made with REALbasic.
The 1.0 beta 3 update sports a redesigned interface, a better, hierarchical
music list, and a massive improvement to vCard support. There many more
improvements and enhancements, see the PodUtil web page
for more info.
|