Check online for Updates: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
Line 26: Line 26:
!include "XML.nsh"
!include "XML.nsh"
!include "OnlineUpdate.nsh"
!include "OnlineUpdate.nsh"
!insertmacro "UpdateXml"
  !insertmacro "UpdateXml"


Section
Section
Line 36: Line 36:
'''Read version from PAD file (XML) and download if newer'''
'''Read version from PAD file (XML) and download if newer'''
<highlight-nsis>
<highlight-nsis>
${UpdatePad} "http://198.63.208.118/padinfo/padgen.xml" "1.0" $0
!include "WordFunc.nsh"
  !insertmacro "VersionCompare"
!include "XML.nsh"
!include "OnlineUpdate.nsh"
  !insertmacro "UpdateXml"
 
!define LocalVersion "1.0"
 
Section
${UpdatePad} "http://198.63.208.118/padinfo/padgen.xml" "${LocalVersion}" $0 ;
StrCmp $0 "" 0 +2
StrCmp $0 "" 0 +2
DetailPrint "Update available at $0"
DetailPrint "Update available at $0"
SectionEnd
</highlight-nsis>
</highlight-nsis>



Revision as of 19:43, 8 December 2007

Description

Let the installer check for newer versions. This function downloads an XML file and queries it for the program version. Useful scenarios are using it with RSS feeds or PAD files. Work in progress!

Syntax

${UpdateXml} [url] [path] $var
 
"[url]"      ; URL to an XML file
"[path]"     ; path to the version resource in your XML file
             ;
             ; Example:
             ; <XML>
             ;     <A>
             ;        <B>information</B>
             ;     </A>
             ; </XML>
             ;
             ; -> use "/XML/A/B" as path
             ;
$var         ; result, in the above example "information"

Example

Read version from XML

!include "XML.nsh"
!include "OnlineUpdate.nsh"
  !insertmacro "UpdateXml"
 
Section
${UpdateXml} "http://198.63.208.118/padinfo/padgen.xml" "/XML_DIZ_INFO/Program_Info/Program_Version" $0
MessageBox MB_OK "The latest version of PADGen is $0"
SectionEnd

Read version from PAD file (XML) and download if newer

!include "WordFunc.nsh"
  !insertmacro "VersionCompare"
!include "XML.nsh"
!include "OnlineUpdate.nsh"
  !insertmacro "UpdateXml"
 
!define LocalVersion "1.0"
 
Section
${UpdatePad} "http://198.63.208.118/padinfo/padgen.xml" "${LocalVersion}" $0 ;
StrCmp $0 "" 0 +2
DetailPrint "Update available at $0"
SectionEnd

Download

OnlineUpdate-0.2.zip (1 KB)
XML plug-in (required)