Announcement

Collapse
No announcement yet.

Retrieve TrueUpdate server Url as a SessionVar

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

  • Retrieve TrueUpdate server Url as a SessionVar

    We have our TrueUpdate files in the same server/directory as the actual payloads. Is there a way to retrieve that location in a script rather than a separate SessionVar? It would be safer to maintain just one location in the code.

  • #2
    You can try this:

    1) Create a session variable, like "%MyLocation%", under Project > Session Variables. You can leave the contents blank, just define the session variable.

    2) Open the TrueUpdate Server list, and create a server from where you want to download the files from. But instead of writing down the location as a complete URL or LAN address, place the session variable %MyLocation% there.

    3) At some moment before the line with

    Code:
    GotServerFiles = TrueUpdate.GetServerFile(ServerName, true);
    you will have to set the contents of the session variable properly, using SessionVar.Set(). Fetch the info where to get the server files from, using the registry, command line arguments or wherever you expect them to be stored, and adjust the contents of the session variable. I am almost certain that this will work as expected.

    Ulrich

    Comment


    • #3
      Thank you. If %MyLocation% is set in the SessionVariable table, is that enough for GetServerFile?
      BTW, where is that line? I do not see it in either the Server or Client Script sections.

      Comment


      • #4
        If you do not see it in the Client script, then check the On Start event script of the Download Server Script screen.
        Yes, defining the value of the Session Variable in the project settings is possible and will work.

        Ulrich

        Comment


        • #5
          Hello, I am trying to do something similar as we execute updates to many client with the same folder structure. I would like to create 1 update process that utilizes an XML file for all the paths. I have the XML working for all the comparison files, but I am trying to get it to work with the server itself. So far I have the following

          -- LOAD THE XML FILE
          XML.Load(_SourceFolder.."\\ClientConfig.xml");
          -- Check whether an error occurred
          error = Application.GetLastError();
          -- If no errors occurred...
          if (error == XML.OK) then
          -- SET THE SERVER VALUE
          SessionVar.Set("%ClientServer%", XML.GetValue("ClientConfig/Servers/ServerName"));
          else
          --Dialog.Message("Error", _tblErrorMessages[error]);
          TrueUpdate.WriteToLogFile ("Error : ".._tblErrorMessages[error].."\r\n", true);
          end

          -- result = TrueUpdate.GetServerFile("JCS Server", false, nil);
          -- lsTmpServerName = SessionVar.Expand("%ClientServer%");
          result = TrueUpdate.GetServerFile(SessionVar.Expand("%Clien tServer%"), false, nil);

          if (result) then
          TrueUpdate.RunScript("Server Script");
          else
          Dialog.Message("Message", "This is bad", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
          error = Application.GetLastError();
          if (error ~= 0) then
          TrueUpdate.WriteToLogFile ("Error : ".._tblErrorMessages[error].."\r\n", true);
          end
          end

          I have tried a couple different things in defining what the value used in the GetServerFile command, but I always end up at the 'This is bad' line.

          Am I doing something incorrectly?

          Thank you

          Comment


          • #6
            Actually, never mind. I made it harder than it should be. I just needed the first GetServerFile to be in place and it worked fine. Thanks.

            Comment

            Working...
            X