How can I write a script to go online?

My third post of the day!

How would I go about making a script that could go online to check for a new version of my app. Perhaps it could download a text file with the information to the preferences folder and display it in a window?

There’s numerous ways of getting data over a http connection.

One of the easiest is probably URL Access Scripting:

tell application “URL Access Scripting”
download “http://www.yourserver.net/path/to/latestver.txt” to file (path to temporary items as string) & latestver.txt"
end tell

You can then read the file and see what the latest version is.

Alternatively, to avoid saving it to disk, use something like:

set latestVer to do shell script “curl http://www.yourserver.net/path/to/latestver.txt

which puts the contents of the file in an AppleScript variable so you can reference it in your script.

Either way, of course, you need to maintain www.yourserver.net with up-to-date information. You should probably also add error handling in your script so that the program still works even if/when www.yourserver.net doesn’t exist or can’t be reached.