forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Check for new version of an app using vdsipp.dll
Goto page 1, 2  Next
 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code
View previous topic :: View next topic  
Author Message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 11:10 pm    Post subject: Check for new version of an app using vdsipp.dll Reply with quote

This script downloads an INI file in the following format and then checks if the user has the latest version of the program.

INI File:

Quote:
[Software info]
Version=1.00


Code:
external vdsipp.dll

rem Version of current app.
%%CurrentVer = 1.0

INTERNET HTTP,CREATE,1
INTERNET HTTP,THREADS,1,OFF
INTERNET HTTP,PROTOCOL,1,1
INTERNET HTTP,USERAGENT,1,"GeoTrail Corporation"
INTERNET HTTP,DOWNLOAD,1,http://www.youwebsite.net/version.ini,@PATH(%0)\version.ini
INTERNET HTTP,DESTROY,1
rem INIFILE OPEN,@path(%0)settings.ini
INIFILE OPEN,@PATH(%0)\version.ini

%%AppVersion = @INIREAD(Software info,Version)

rem Checks if there is a newer version.
IF @GREATER(%%AppVersion,%%CurrentVer)
   INFO There is a new version available.@cr()You have version v%%CurrentVer.@cr()Latest version is v%%AppVersion.
   Else
   INFO You have the latest version.
END

rem Deletes the file before closing the app.
file delete,@PATH(%0)\version.ini
:Close
Exit

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Wed Feb 19, 2003 11:19 pm    Post subject: Reply with quote

This one is alittel better. With this you can add not only version number, but also build number.

Code:
external vdsipp.dll

%%CurrentVer = 1.0
%%CurrentBuild = 230

INTERNET HTTP,CREATE,1
INTERNET HTTP,THREADS,1,OFF
INTERNET HTTP,PROTOCOL,1,1
INTERNET HTTP,USERAGENT,1,"GeoTrail Corporation"
INTERNET HTTP,DOWNLOAD,1,http://www.yourwebsite.net//version.ini,@PATH(%0)\version.ini
INTERNET HTTP,DESTROY,1
rem INIFILE OPEN,@path(%0)settings.ini
INIFILE OPEN,@PATH(%0)\version.ini
%%AppVersion = @INIREAD(Software info,Version)
%%AppBuild = @INIREAD(Software info,Build)

IF @GREATER(%%AppVersion.%%AppBuild,%%CurrentVer.%%CurrentBuild)
   INFO There is a new version available.@cr()You have version v%%CurrentVer.%%CurrentBuild.@cr()Latest version is v%%AppVersion.%%AppBuild.
   Else
   INFO You have the latest version.
END
file delete,@PATH(%0)\version.ini

:Close
Exit

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Wed Feb 19, 2003 11:29 pm    Post subject: Reply with quote

Handy code to have around. A few others have made systems that
download the updates.

_________________
FreezingFire
VDSWORLD.com
Site Admin Team
Back to top
View user's profile Send private message Visit poster's website
marty
Professional Member
Professional Member


Joined: 10 May 2001
Posts: 789

PostPosted: Thu Feb 20, 2003 12:53 am    Post subject: Reply with quote

Yup I did one called i.Update System if you ever to try that Geotrail...its one my web site... its free too! Nice script you did there Geotrail!
Back to top
View user's profile Send private message Send e-mail Visit poster's website MSN Messenger
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Feb 20, 2003 1:06 am    Post subject: Reply with quote

Hi marty.
Yeah, I've tried it.
But I figured, why not try making my own Wink

When I'm gonna learn, I might as well go all the way.

Thanks for the kind words on the code Smile

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1562

PostPosted: Thu Feb 20, 2003 7:01 am    Post subject: Reply with quote

Very nice code, however here are some suggestions:

1. Use INTERNET HTTP,GET that way you do not have to save any file to disk. By using @internet(http,content,1) it will return the contents of the html/text you retrieved with the GET command.

2. Instead of having Ini format, you can simplify this for yourself and save a few bytes off the download and off your server's bandwidth usage Smile by just putting the version number of the app only in the file '1.00'. *remember that this will be used internally and most of your software users will never see such a file so it need not be pretty, barebones will work*

3. Now you can dump the contents of the @internet(http,content,1) to a list and read the version number. This allows you to save bytes off the download and no files written to disk.


Code:

INTERNET HTTP,CREATE,1
INTERNET HTTP,THREADS,1,OFF
INTERNET HTTP,GET,1,http://www.whatever.com/version.txt

list create,1
list add,1,@internet(http,content,1)
warn @item(1,0)
list close,1

INTERNET HTTP,DESTROY,1
Back to top
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Feb 20, 2003 5:11 pm    Post subject: Reply with quote

Aaa didn't think of that.
Thanks for the tip Smile

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Feb 20, 2003 5:17 pm    Post subject: Reply with quote

If you only download a one-line textfile, you can also use this to display the results, without the need of having a list:

Code:
warn @internet(http,content,1)


Or you could place it into a variable, so that you can check if it's newer then the current version (with @greater(%%version,%%newestversion))...
Back to top
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Feb 20, 2003 5:33 pm    Post subject: Reply with quote

Yeah, but I do need more than that.

For my program I need the program name, version, build, update date, download url and probably some information about the update itself.

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1562

PostPosted: Thu Feb 20, 2003 5:54 pm    Post subject: Reply with quote

Yup that's why using a list will allow you to lookup multiple fields, simply change the list index number to pull up the next value:

warn @item(1,0)
warn @item(1,1)
warn @item(1,2)
warn @item(1,3)

and so on..
Back to top
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Feb 20, 2003 6:23 pm    Post subject: Reply with quote

And how would I format the update information file?
One field per line?

Like this?

App name
App version
App build

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Feb 20, 2003 7:00 pm    Post subject: Reply with quote

Yes, because then you can get the information the way Prakash told. Be sure that you use the same line number for the info all the time, or use something like this:

Code:

list create,1
rem Replace the line below with the code to download from your server...
list assign,1,appname:GeoTrail@cr()version:1.4@cr()build:0.1.7.4

list seek,1,0
if @match(1,appname:)
  %%appname = @substr(@item(1),@succ(@pos(:,@item(1))),@len(@item(1)))
  end

list seek,1,0
if @match(1,version:)
  %%version = @substr(@item(1),@succ(@pos(:,@item(1))),@len(@item(1)))
  end 

list seek,1,0
if @match(1,build:)
  %%build = @substr(@item(1),@succ(@pos(:,@item(1))),@len(@item(1)))
  end

list close,1

info The appname is %%appname@cr()The version is %%version@cr()And the build is %%build


Because of the list seek and @match() commands, you can put the info where-ever you like, as long it isn't on the same line... Please note the the downloaded data should be formated like function:value...
Back to top
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Feb 20, 2003 8:00 pm    Post subject: Reply with quote

Great.
Thanks alot for the example.
I have a question about extensions.
I've seen in alot of example scripts that uses extensions that it has some extra info added to the call line like this:

external vdsinet.dll,Public Freeware Key|90257236

What does that mean?

_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Thu Feb 20, 2003 8:04 pm    Post subject: Reply with quote

Those extensions are free to use in the KDE of VDS, but you have to registrate them to use them in compiled programs. The stuff after the DLL name will be used to check if you are a registrated user of it. The DLL you mentioned is created by Tommy Sools. It once was shareware, but now freeware, but you still have to use this parameters to run it, so the DLL knows you are a 'registrated' user...
Back to top
View user's profile Send private message
GeoTrail
Valued Contributor
Valued Contributor


Joined: 18 Feb 2003
Posts: 572
Location: Bergen, Norway

PostPosted: Thu Feb 20, 2003 8:10 pm    Post subject: Reply with quote

OK, might be a dumb question, but do I have to add the code stated above, with the same number? Or can I just make up my own? Embarassed
_________________
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Visual DialogScript 4 Source Code All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group