Old 6th June 2003, 16:19   #1
Merlin73
Junior Member
 
Join Date: May 2003
Location: Australia
Posts: 1
Help with update program

Hi,
Could someone please help me write a script? I'm new to NSIS and I've created an install script successfully. But I want to use NSIS to write a program that not only downloads an updated version of my program off the internet, but checks to see if it's a newer version first. I've read the documentation and know how to use NSISdl::download, but don't know how to write the rest of the code. (If it was Delphi I could do it)
The idea I have is the updater will read the program's ini file to find the version and compare it with an ini file on the website, if the ini file on the web contains a higher version number it will download the program.
Merlin73 is offline   Reply With Quote
Old 6th June 2003, 17:07   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
That can be done and I did it with my program - it did exactly what you want to do!

You can either use GetFileTime to compare the program files like so:
code:

GetFileTime "C:\olderfile.exe" $3 $4
GetFileTime "C:\downloadedfile.exe" $5 $6

IntCmp $3 $5 0 skip +2
IntCmp $4 $6 skip skip 0

Delete "C:\olderfile.exe"
Rename "C:\downloadedfile.exe" "C:\olderfile.exe"
skip:



Or, use:
code:

NSISdl::download "http://myweb.server.com/downloadedfile.ini" "C:\downloadedfile.ini"

ReadINIStr $0 "C:\olderfile.ini" "File Version" "Version"
ReadINIStr $1 "C:\downloadedfile.ini" "File Version" "Version"
IntCmp $0 $1 skip 0 skip

NSISdl::download "http://myweb.server.com/downloadedfile.exe" "C:\olderfile.exe"
MessageBox MB_OK|MB_ICONINFORMATION "Downloaded file update for olderfile.exe!"

skip:



Hope it helps!

-Stu
Afrow UK is offline   Reply With Quote
Old 6th June 2003, 17:07   #3
Joel
Debian user
(Forum King)
 
Joel's Avatar
 
Join Date: Jan 2003
Location: Arch land
Posts: 4,917
check this old thread:
http://forums.winamp.com/showthread....hreadid=135626


* PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with MATE.
* Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with MATE.
Joel is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump