Making an Update

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • royornelas
    Forum Member
    • Jun 2003
    • 9

    Making an Update

    I am creating an application and I want it to automatically check the web to see if there is an update.

    I have been successful using the following:
    At Application start:
    %FileInfo% = File.GetInformation (Existence, "%SrcDir%\Updates\test.zip")
    IF (%FileInfo%=TRUE)
    ZipFile.Extract ( "%SrcDir%\Updates\test.zip", "*.*", "%SrcDir%")
    File.Delete ("%SrcDir%\Updates\test.zip")
    END IF

    At Application exit:
    %Result% = Dialog.MessageBox ("E Update", "Would you like to check for an...", Yes|No, Question)
    IF (%Result%=NO)
    Application.Exit
    ELSE
    Internet.DownloadWebFile ("http://www.myweb.com/update.zip", "%SrcDir%/Updates")
    %UpdateSuccessful% = Dialog.MessageBox ("Title", "Your Ellusionist Interface has...", Ok, Information)
    IF (%UpdateSuccessful%=OK)
    Application.Exit
    END IF
    END IF

    However the problem is that everytime the user exits the program, he will receive a dialog box asking him if he wants to check for an update.

    I want to make it so the dialog box will appear every 30 days instead of everytime the user exits the app.

    Looking at the Knowledge Base, I found the following:
    %Date% = System.GetDateTime ( "Date", "Julian Date")
    %ExpDate% = "FALSE"
    %ExpDate% = Registry.GetValueData ("HKEY_CURRENT_USER\HiddenKey", "Date")
    IF (%ExpDate% = FALSE)
    %ExpDate% = Evaluate (%Date% + 30)
    Registry.SetValue ("HKEY_CURRENT_USER\HiddenKey", "Date", "%ExpDate%")
    END IF
    IF (%Date% >= %ExpDate%)
    %Result% = Dialog.MessageBox ("Expired", "This application has expired.", Ok, Stop)
    Application.Exit
    END IF

    I was wondering how I can modify it so that I can have the app check the web for an update instead of having the app expire.

    Thanks for your help.

    Roy
  • Corey
    Indigo Rose Staff Alumni
    • Aug 2002
    • 9745

    #2
    Re: Making an Update

    Hi. I have nothing to offer on this one although I'm sure the others will but I just wanted to invite you to download the free trial version of our software TrueUpdate, a professional tool for adding "update from web" features to your software and projects.

    TrueUpdate is made specifically for this and offers you a tons of great features targetted specifically at this task. You can make even very advanced installers in just minutes... TrueUpdate is way too awesome to describe in just a few sentences here but if you check out the free trial version I think you'll be amazed at how relevant this tool actually is to you. [img]/ubbthreads/images/icons/smile.gif[/img]

    BTW You can download it by clicking on the Products tab above and then on the "TrueUpadte" sub-tab.

    Corey Milner
    Creative Director, Indigo Rose Software

    Comment

    • Worm
      Indigo Rose Customer
      • Jul 2002
      • 3971

      #3
      Re: Making an Update

      A couple things...

      First you're going to have to have something to compare the running version against the version that is available to download. Otherwise, no matter if they've downloaded and installed the update, the update is still out there, and it would want them to update again. You could use a registry entry to store the current version, and have a text file to download for the updated version. Compare the registry value to the downloaded text value, if it's greater then trigger the update.

      As for modifying the above code. You'd have to write to the registry or a text file the last time the app was updated, compare that value to the date to see if its time to check for updates.

      Also, remember that you can't overwrite the EXE if its in use, you might think of creating a seperate AMS app than the one you are trying to update, otherwise you wouldn't be able to replace the EXE. If you simply doing data or images, no sweat.

      Comment

      • royornelas
        Forum Member
        • Jun 2003
        • 9

        #4
        Re: Making an Update

        Corey,

        Thanks for your advice but I am very limited in my budget and cannot afford the expense of another $400 on TrueUpdate, when AutoPlay Media has the capacity to accomplish what I need.

        Worm:
        Let me give you a little more background. My app is basically an "ebook" app.

        I have embedded a Web Browser object in that app. That web browser contains an HTML file that I want to update every 30 days.

        I know the easiest thing is for me to have the web browser be "live" and link to the web, but most of my clients will want to view the ebook offline and so they need to download my html file.

        I was thinking of creating a "value" and set that at 0, and compare that to the date. When the value is equal to 30 days from the date of install, it will check the web for an update and reset the value back to 0.

        I appreciate all the responses.

        Thanks again to both of you.

        Roy

        Comment

        • royornelas
          Forum Member
          • Jun 2003
          • 9

          #5
          Re: Making an Update

          I think I have been able to accomplish what I need.



          %JulianDate% = System.GetDateTime ( "Date", "Julian Date")
          %FirstRunDate% = "NOTFOUND"
          %RegData% = Registry.GetValueData ("HKEY_LOCAL_MACHINE\Software\MYSITE\Updates\Updat e After 1 Day", "Device Address")
          IF (%FirstRunDate%="NOTFOUND")
          %FirstRunDate% = "%JulianDate%"
          Registry.SetValue ("HKEY_LOCAL_MACHINE\Software\MYSITE\Updates\Updat e After 1 Day", "Device Address", "%FirstRunDate%") END IF

          IF ((%JulianDate% - %FirstRunDate%) =1)
          %FirstRunDate%="NOTFOUND"
          %Result% = Dialog.MessageBox ("Update", "Would you like to search for a...", Yes|No, Question)
          IF (%Result%="YES")
          Internet.DownloadWebFile ("http://www.emywebsite.com/order/test.zip", "%SrdDir%\Updates")
          ZipFile.Extract ( "%SrcDir%\Updates\test.zip", "*.*", "%SrcDir%")
          END IF
          END IF

          The reason I have set the action
          IF ((%JulianDate% - %FirstRunDate%) =1)

          is because I want to make sure it requests me to update tomorrow.

          I already compiled and ran the program. I have checked the registry and the %FirstRunDate% value is present in the registry.

          If it does ask me to update tomorrow I will change the action to IF ((%JulianDate% - %FirstRunDate%) >30)

          I am hoping the following action
          IF ((%JulianDate% - %FirstRunDate%) >30)
          %FirstRunDate%="NOTFOUND"

          works because if it does NOT reset the registry value, then the user will be asked to update everyday after 30 days.

          Tell me what you guys think.

          Comment

          • Lorne
            Indigo Rose Staff Member
            • Feb 2001
            • 2729

            #6
            Re: Making an Update

            I would suggest changing the value of the FirstRunDate in the Registry after you complete (or at least initiate) an update. So, replace the value in the Registry with today's date.

            Should go like this:

            Get %FirstRunDate% from the Registry.

            If it's not there, set the Registry value to %JulianDate% and you're done.

            If it's there, check whether %JulianDate% - %FirstRunDate% > 30 and if so, perform the update, and set the first run date in the Registry to %JulianDate%.

            If not, continue as always.
            --[[ Indigo Rose Software Developer ]]

            Comment

            • royornelas
              Forum Member
              • Jun 2003
              • 9

              #7
              Re: Making an Update

              I just want to give you guys an update on my project.

              All I can say is it worked.

              Here is the code I am using.

              %JulianDate% = System.GetDateTime ( "Date", "Julian Date")
              %FirstRunDate% = "NOTFOUND"
              %FirstRundDate% = Registry.GetValueData ("HKEY_LOCAL_MACHINE\Software\MYSITE\Updates\Updat e After 30 Days", "Device Address")
              IF (%FirstRunDate%="NOTFOUND")
              %FirstRunDate% = "%JulianDate%"
              Registry.SetValue ("HKEY_LOCAL_MACHINE\Software\MYSITE\Updates\Updat e After 30 Days", "Device Address", "%FirstRunDate%")
              END IF

              IF ((%JulianDate% - %FirstRunDate%) >30)
              %Result% = Dialog.MessageBox ("Update", "Would you like to search for a...", Yes|No, Question)
              IF (%Result%="YES")
              Internet.DownloadWebFile ("http://www.emywebsite.com/order/test.zip", "%SrdDir%\Updates")
              ZipFile.Extract ( "%SrcDir%\Updates\test.zip", "*.*", "%SrcDir%")
              Registry.SetValue ("HKEY_LOCAL_MACHINE\Software\Ellusionist\Updates\ Update After 30 Days", "Device Address", "%JulianDate%")
              END IF
              END IF

              This has worked for me. After 30 days, it will check the web and download my update if any. If there is no update available, I have created a custom error message that states there are no updates available and that the user has the current version.

              Thanks again for your help.

              Comment

              Working...
              X