{"id":12,"date":"2007-12-15T16:15:17","date_gmt":"2007-12-16T00:15:17","guid":{"rendered":"http:\/\/www.installaware.com\/blog\/?p=12"},"modified":"2008-01-04T07:42:38","modified_gmt":"2008-01-04T15:42:38","slug":"online-serial-key-validation-with-installaware-the-updates-part","status":"publish","type":"post","link":"https:\/\/www.installaware.com\/blog\/?p=12","title":{"rendered":"Online Serial Key Validation with InstallAware, the Updates Part"},"content":{"rendered":"<p>A question we get a lot here is how exactly our update mechanism works. It&#8217;s actually very straightforward. You define your existing software update packages inside our IDE, which saves that information inside an <em>updates.ini<\/em> file. You then upload both the update installers (patches, single exe&#8217;s, whatever you like) and the <em>updates.ini <\/em>file, overwriting the old INI if any, and you are good to go! The next time a scheduled update check runs, your users will be automatically notified by the <strong>InstallAware Web Update Client <\/strong>that new updates are available for download. But what if you want to check for updates each time that your application is launched, and automatically install them if any are available?<\/p>\n<p>As I am fond of saying, <strong>InstallAware is extremely flexible.<\/strong> There&#8217;s a very simple way to do this. To get started, <strong>open the updates script at the<\/strong> <strong>MSIcode tab &#8211;<\/strong> this is <strong>found under the &#8220;Include Scripts&#8221; heading of the Project Manager<\/strong> which is normally docked to the left of the IDE in the MSIcode tab.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/MSICode.png\" \/> and then<img decoding=\"async\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/updates.png\" \/><\/p>\n<p>The <strong>updates script <\/strong>creates shortcuts for the <strong>InstallAware Web Update Client <\/strong>wrapper. If you look at lines 24 and 26 of the standard update script, you&#8217;ll see that these shortcuts point to the <strong>$UNINSTALLLINK$ pre-defined MSIcode variable<\/strong>. This pre-defined variable points to your <em>setup.exe<\/em> file as cached on the target system, which acts both as your setup driver, and also the web update client.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/uninstalllink.png\" \/><\/p>\n<p>Now, <strong>in your main setup,<\/strong> instead of creating a shortcut for your application&#8217;s EXE file (ex: C:\\Program Files\\My Software\\My Application.exe), create a shortcut for $UNINSTALLLINK$ instead (type this inside the <strong>Shortcut to File <\/strong>field), and specify the &#8220;<strong>\/update<\/strong>&#8221; command line parameter for the shortcut, which will start <em>setup.exe <\/em>in web update client mode (instead of the regular maintenance\/uninstallation mode).<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/shorcut.png\" \/><\/p>\n<p>Also, remember to change the shortcut icon to your application&#8217;s icon, so your users won&#8217;t be confused with a setup icon in their Start Menu.<\/p>\n<p>Now, every time a user clicks your application&#8217;s shortcut in the Start Menu, the web update client will launch, and check for updates! But of course, we still need to fix the web update client so it&#8217;ll know to launch the main application after checking for updates. Otherwise, users have no way of running the application, since the Start Menu shortcut doesn&#8217;t even point to your application anymore.<\/p>\n<p>This is easy too. Again, on the <strong>MSIcode <\/strong>tab, navigate to the <strong>updates <\/strong>script.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/MSICode.png\" \/><img decoding=\"async\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/updates.png\" \/><\/p>\n<p>Search for the &#8220;<strong>Terminate Installation<\/strong>&#8221; command throughout the <strong>updates <\/strong>script. I recommend typing <em>Ctrl+F <\/em>and searching for &#8220;<em>Terminate<\/em>&#8220;, and then repeating the search by typing <em>F3<\/em>. That way you won&#8217;t miss anything.<\/p>\n<p><a href=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/TerminateSearch.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"width: 843px; height: 221px\" height=\"221\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/TerminateSearch.png\" width=\"843\" \/><\/a><\/p>\n<p>Before each &#8220;<strong>Terminate Installation<\/strong>&#8221; command, insert a &#8220;<strong>Run Program As<\/strong>&#8221; command with the target being your main application file (such as &#8220;$TARGETDIR$\\my application.exe&#8221;), and also setting the working directory to &#8220;<strong>$TARGETDIR$<\/strong>&#8220;.<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/RunProgram.png\" \/><\/p>\n<p>Copy-paste this command before each &#8220;<strong>Terminate Installation<\/strong>&#8221; command inside the <strong>updates <\/strong>script. With this simple trick, your application will launch any time the web update client exits &#8211; be it upon user abort, failure, or successful update installation. You&#8217;re fully covered since you addressed each script termination point.<\/p>\n<p>What if you want to check if this end-user has not paid her subscription fees and thus updates are not to be made available for her? It&#8217;s easy. Set up a web page and call it like I described on my previous post using <strong>Download File <\/strong>and <strong>Parse String &#8211; <\/strong>to find out if your user is eligible for updates. I do this by passing her serial number as a parameter to my custom <em>check_updates.aspx<\/em> page on the server, and then I read back the response. If the response is &#8220;<em>1<\/em>&#8221; the end-user can update but if the response is &#8220;<em>0<\/em>&#8220;, the end-user is denied access to the update. When the response is &#8220;<em>0<\/em>&#8221; you can place another &#8220;<strong>Run Program As<\/strong>&#8221; and &#8220;<strong>Terminate Install<\/strong>&#8221; command pair, in order to make your program run directly without checking for updates. You should place all of these <strong>MSIcode commands<\/strong> at the very top of the <strong>updates<\/strong> script, before any actual web update client code runs.<\/p>\n<p><a href=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/updates-check.png\" target=\"_blank\"><img decoding=\"async\" src=\"http:\/\/www.installaware.com\/blog\/pics\/updates-part\/updates-check.png\" \/><\/a><\/p>\n<p>Coming up next: It&#8217;s about time to look at some <strong>.php and .aspx code<\/strong>, and also <strong>MySQL and MS SQL database scripts<\/strong>, for the server back end! Don&#8217;t miss it! \ud83d\ude42<\/p>\n<p>Panagiotis Kefalidis<br \/>\nSoftware Design Team Lead<br \/>\nInstallAware Software Corporation<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A question we get a lot here is how exactly our update mechanism works. It&#8217;s actually very straightforward. You define your existing software update packages inside our IDE, which saves that information inside an updates.ini file. You then upload both the update installers (patches, single exe&#8217;s, whatever you like) and the updates.ini file, overwriting the &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.installaware.com\/blog\/?p=12\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Online Serial Key Validation with InstallAware, the Updates Part&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-12","post","type-post","status-publish","format-standard","hentry","category-msi-code-scripting"],"_links":{"self":[{"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12"}],"version-history":[{"count":0,"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.installaware.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}