Announcement

Collapse
No announcement yet.

Silent Check for Update.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Silent Check for Update.

    I was trying the silent check code that you posted on your other site. I removed everything from the client script and added your code. I adjusted the "g_TargetVersion" in the service script to a version that would cause the install to update. However, with or without the "/show" parameters set on the command line of the shortcut. I do see that the law was generated in the return code was zero.

    However, if I also run the command line without the "/show" parameter again I seethe log file generated in the return code is zero, but nothing is updated and the install does not show up. Is there something else I need to be doing here? Do I need to also include the default show screen? It's obvious I'm not understanding this totally.

    Oh, by the way. I also set the "AS invoker".

    ------------------------------------------
    -- Download and run the Server Script
    ------------------------------------------

    -- Suppress all screens until an update is available?

    g_SilentUntilUpdateAvailable = true;

    -- check command line arguments passed and see if g_SilentUntilUpdateAvailable
    -- should be overridden

    for i, arg in _CommandLineArgs do

    if (String.CompareNoCase(arg, "/show") == 0) then

    -- updater was called with the "/show" argument (from the Start Menu shortcut)

    g_SilentUntilUpdateAvailable = false;

    end

    end

    Thanks,
    James

  • #2
    I suggest that you create a new project from the beginning, selecting the "wizard style" so you have to navigate through a series of screens to check for updates, download, etc. Once this is properly set up and tested, add my code, to control the g_SilentUntilUpdateAvailable variable. If that variable is set, you wouldn't show the initial dialogs, and the first to appear would be the one telling the user that an update is available. You took this code from an explanation how to use command line arguments, and you still may need to make changes to the script to make it behave as you wish once you have set the g_SilentUntilUpdateAvailable variable.

    Ulrich

    Comment


    • #3
      Thanks Ulrich for the reply.

      Ulrich, I had a working project that was done via the wizard style, but took your advice and created another one. I got this one to function as well. I tested to make sure it downloaded and also executed the .msi correctly.

      My testing included changing the target version from the service script that is located in the registry to determine if it can evaluate a new or current version; all worked correctly.

      However, in looking at the client script and the default code that is generated. I'm not sure where to place your sample code. I tried placing it at the beginning and left the template code at the end; didn't work. I also tried integrating the template code into your sample code just under "g_SilentUntilUpdateAvailable = false; "; but that didn't work either.

      I like the concept of being able to file check each time the program is started without bothering the user. However, I must be missing something because as simple as this code looks; it's not working for me. Any suggestions here?

      Comment


      • #4
        Just something added:

        Well, I think I see the first problem and that is I'm unsure of how to get the command line argument/ parameters (C:\Users\UserName\AppData\Roaming\manufacturer\Na mesOfSoftware>TrueUpdateClient.exe /show) into (for i, arg in _CommandLineArgs do).

        I also placed the /show in the shortcut and turned on debugging, but I see no output. Also from the command line I execute the update client both with the /show and without and again nothing. So, by the looks of it I'm kind of missing how to get this argument into (_CommandLineArgs) so that it can be evaluated as having the /show or not.

        Comment


        • #5
          Hi Ulrich,

          Here's my last update for the night. I got part of it to work but still I'm missing something; see code below. If I add the /show the start up screen does display and if I remove the "/show", the startup screen does not display. This would indicate that it's working correctly however, if I change the "g_TargetVersion" target version to a newer version and do not add the "/show", then it does not work correctly; the setup screen does not display.

          Client Script:
          g_SilentUntilUpdateAvailable = true;

          ------------------------------------------
          -- Download and run the Server Script
          ------------------------------------------

          for i, arg in _CommandLineArgs do
          if (String.CompareNoCase(arg, "/show") == 0) then
          -- updater was called with the "/show" argument (from the Start Menu shortcut)
          g_SilentUntilUpdateAvailable = false;

          -- Only show the startup/welcome screens if they haven't already been shown
          if(not _ClientRestarted) then
          Screen.Show("Startup");
          end

          -- Download and run the server script
          if(Screen.Show("Connect to Server") == SR_SUCCESS) then
          TrueUpdate.RunScript("Server Script");
          end
          end
          end


          Can you point out what I'm doing wrong?

          Thanks.

          Comment


          • #6
            It might help if you post the actual project you are using. Making this work is really not that difficult, so I don't quite understand what you are struggling with.

            In your latest post, you are not closing the for loop where you should. On my web page I explain that the code I show should be placed at the start of the script, yet this isn't what you are doing: You are calling Screen.Show("Connect to Server") only if there was a command "/show" command line argument, and you won't execute (apparently) the Server Script at all if the command line argument wasn't supplied, which of course is wrong. Using indentation (and the [CODE] tags when posting) makes the script more readable. This is your code you posted above, with formatting/indentation, and you can see that the code is placed incorrectly inside the loop:

            Code:
            [COLOR="#0000FF"]for[/COLOR] i[COLOR="#FF0000"],[/COLOR] arg [COLOR="#0000FF"]in[/COLOR] _CommandLineArgs [COLOR="#0000FF"]do[/COLOR]
              [COLOR="#0000FF"]if[/COLOR] (String[COLOR="#FF0000"].[/COLOR]CompareNoCase(arg[COLOR="#FF0000"],[/COLOR] [COLOR="#800080"]"/show"[/COLOR]) [COLOR="#FF0000"]==[/COLOR] [COLOR="#000000"]0[/COLOR]) [COLOR="#0000FF"]then[/COLOR]
                [COLOR="#008000"]-- updater was called with the "/show" argument (from the Start Menu shortcut)[/COLOR]
                g_SilentUntilUpdateAvailable [COLOR="#FF0000"]=[/COLOR] [COLOR="#0000FF"]false[/COLOR][COLOR="#FF0000"];[/COLOR]
            
                [COLOR="#008000"]-- Only show the startup/welcome screens if they haven't already been shown[/COLOR]
                [COLOR="#0000FF"]if[/COLOR]([COLOR="#0000FF"]not[/COLOR] _ClientRestarted) [COLOR="#0000FF"]then[/COLOR]
                  Screen[COLOR="#FF0000"].[/COLOR]Show([COLOR="#800080"]"Startup"[/COLOR])[COLOR="#FF0000"];[/COLOR]
                [COLOR="#0000FF"]end[/COLOR]
            
                [COLOR="#008000"]-- Download and run the server script[/COLOR]
                [COLOR="#0000FF"]if[/COLOR](Screen[COLOR="#FF0000"].[/COLOR]Show([COLOR="#800080"]"Connect to Server"[/COLOR]) [COLOR="#FF0000"]==[/COLOR] SR_SUCCESS) [COLOR="#0000FF"]then[/COLOR]
                  TrueUpdate[COLOR="#FF0000"].[/COLOR]RunScript([COLOR="#800080"]"Server Script"[/COLOR])[COLOR="#FF0000"];[/COLOR]
                [COLOR="#0000FF"]end[/COLOR] 
              [COLOR="#0000FF"]end[/COLOR]
            [COLOR="#0000FF"]end[/COLOR]
            The idea of parsing the command line arguments is that at program start you scan all arguments which were provided, and set variables to control the behavior of the program as desired. This isn't a situation where you would perform tasks as many times as there were arguments on the command line. I hope this makes sense.

            Ulrich

            Comment


            • #7
              Ulrich, I never seen the [CODE] tag, just wasn't paying attention to it; didn't look under the Advanced button. Sorry about that, wasn't trying to make it difficult for you. I know the code should be easy, but I'm missing something or just not seeing the big picture. I thought I was following the logic whereas the initial command was placed on line one and would be to go silent unless there is an update. This equals true so therefore I was thinking that it would always be on by default. When I added the code under the "g_SilentUntilUpdateAvailable = false;", I was thinking that this meant it was turned off and the initial screen.show should be initiated; apparently I'm wrong.

              As for not closing the loop, your program won't compile it with the loop is broken. I thought I did close the loop. :-( Thanks for clarifying the scan process on the arguments and that I shouldn't of placed in the code in there anyway. I suppose this is what leads me in the fog.

              Anyway, I've attached the project.
              Attached Files

              Comment


              • #8
                Awesome! Thank you much Ulrich; you've been a great help. It looked like my whole issue was that I did not check the"Don't show any interface unless an update is available" checkbox when first building the project. Then, I would've only needed to place your code just under "g_SilentUntilUpdateAvailable = true;" which is on the first line.

                Great code Ulrich, thanks again. :lol

                Comment


                • #9
                  Please send me link of scripts no have ! help me

                  Comment

                  Working...
                  X