Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 26th January 2007, 02:06   #1
eyeinthesky43
Junior Member
 
Join Date: May 2005
Posts: 28
Need help this is confusing

Alright basically what I am trying to do is make a small updater that will download an ini file from the web and compare the version number in the ini with the ini file that is on the system and if the version number is newer then it will download the update. This is what I have:

code:
NSISdl::download "http://www.site.com/new.ini" "C:\new.ini"

ReadINIStr $0 "C:\old.ini" "File Version" "Version"
ReadINIStr $1 "C:\new.ini" "File Version" "Version"
IntCmp $0 $1 lessthan$1 morethan$0
lessthan$1:
DetailPrint "No Update"
Goto done
morethan$0:
DetailPrint "Update"
NSISdl::download "http://www.site.com/Update.zip" "C:\Update.zip"
MessageBox MB_OK|MB_ICONINFORMATION "Downloaded file update!"
done:



The only part that seems to work is the first part that downloads new.ini, I'm a noob to NSIS so any help on this would be great.
eyeinthesky43 is offline   Reply With Quote
Old 26th January 2007, 04:25   #2
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
See documentation, 4.9.4.13 IntCmp

val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]

e.g.
intCmp $1 $0 no_download no_download download

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 26th January 2007, 05:49   #3
eyeinthesky43
Junior Member
 
Join Date: May 2005
Posts: 28
Ugh ok I have been trying hard to figure this out but can't seem to get it, I read the documentation and changed the code which now it looks like it makes more sense and should work but sadly still not working like it should.

code:
NSISdl::download "http://www.site.com/new.ini" "C:\new.ini"

ReadINIStr $0 "C:\old.ini" "File Version" "Version"
ReadINIStr $1 "C:\new.ini" "File Version" "Version"
IntCmp $0 $1 is$0 lessthan$0 morethan$0
is$0:
DetailPrint "No Updates"
Goto done
lessthan$0:
DetailPrint "No Updates"
Goto done
morethan$0:
DetailPrint "Updates"
NSISdl::download "http://www.site.com/Update.zip" "C:\Update.zip"
MessageBox MB_OK|MB_ICONINFORMATION "Downloaded file update!"
done:

eyeinthesky43 is offline   Reply With Quote
Old 26th January 2007, 06:17   #4
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
val1 val2 jump_if_equal [jump_if_val1_less] [jump_if_val1_more]

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 26th January 2007, 06:19   #5
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
EDIT: double post

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS

Last edited by Red Wine; 26th January 2007 at 06:48.
Red Wine is offline   Reply With Quote
Old 26th January 2007, 06:21   #6
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,220
1. Good idea is to get result code from stack (Pop) after every download - see NSISdl examples.
2. Use labels without $
3. Use MessageBox for debugging-tracing.
code:
MessageBox MB_OK "old=$0 new=$1"
Takhir is offline   Reply With Quote
Old 26th January 2007, 06:36   #7
eyeinthesky43
Junior Member
 
Join Date: May 2005
Posts: 28
Ok so it's now setup just like you posted yet it's not downloading the update.zip:

code:
NSISdl::download "http://www.site.com/new.ini" "C:\new.ini"

ReadINIStr $0 "C:\old.ini" "File Version" "Version"
ReadINIStr $1 "C:\new.ini" "File Version" "Version"
IntCmp $0 $1 jump_if_equal jump_if_$0_less jump_if_$0_more
jump_if_equal:
DetailPrint "No Updates"
Goto done
jump_if_$0_less:
DetailPrint "No Updates"
Goto done
jump_if_$0_more:
DetailPrint "Updates"
NSISdl::download "http://www.site.com/Update.zip" "C:\Update.zip"
MessageBox MB_OK|MB_ICONINFORMATION "Downloaded file update!"
done:



Could it be I have my ini files setup wrong and it's not reading them correctly? I mean I am pretty sure they are set up right:

new.ini text:
[File Version]
Version=1.1

old.ini text:
[File Version]
Version=1.0

Sorry for being a complete noob at this.....
eyeinthesky43 is offline   Reply With Quote
Old 26th January 2007, 06:38   #8
eyeinthesky43
Junior Member
 
Join Date: May 2005
Posts: 28
Thanks Takhir, I will try it and see if I have some luck.
eyeinthesky43 is offline   Reply With Quote
Old 26th January 2007, 06:46   #9
Red Wine
Forum King
 
Red Wine's Avatar
 
Join Date: Mar 2006
Location: Ath. GR
Posts: 2,078
versions are not integers
you should try E.3.16 VersionCompare

Quick AVI Creator - Quick and easy convert from DVD/MPEG/AVI/MKV to AVI/MP4/MKV
Quick AVI Creator entirely edited with NSIS and entirely upgraded to Unicode NSIS
Red Wine is offline   Reply With Quote
Old 26th January 2007, 10:59   #10
eyeinthesky43
Junior Member
 
Join Date: May 2005
Posts: 28
Thank you so much for helping it finally works.
eyeinthesky43 is offline   Reply With Quote
Old 13th September 2009, 02:19   #11
Rein Masamuri
Junior Member
 
Join Date: Nov 2002
Posts: 11
Send a message via ICQ to Rein Masamuri Send a message via AIM to Rein Masamuri Send a message via Yahoo to Rein Masamuri
Will make a new thread >.<

Last edited by Rein Masamuri; 13th September 2009 at 02:50.
Rein Masamuri is offline   Reply With Quote
Reply
Go Back   Winamp 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