5 Replies Latest reply: Jun 10, 2016 5:21 PM by Gabriele Pisoni RSS

    Managing Hidden Script

    David Wellman

      Hi all,

       

      I'm looking for suggestions / experience / ideas about how to manage 'hidden scripts' specifically during and when moving from dev to production.

       

      We've got them in one of our apps so that when deployed customers cannot see or edit them.

       

      However, during development it's a real pain when you want to edit them because every time you have to enter the password. And of course you get no logging information for debugging purposes.

       

      What we're thinking of right now is to have nothing hidden during development so that we have easy access to the scripts for editing and debugging. As part of our 'go live' process we'll move all of the scripts into one/more 'hidden' tabs. (If anyone has an automated way of doing that I'll be very grateful).

       

      So:

      Has anyone else come across the same situation?

      How do you handle it?

      Do my ideas above make sense or am I going to cause myself lots of problems?

       

      We're currently using QV 11.

       

      Cheers,

      Dave

        • Re: Managing Hidden Script
          Gysbert Wassenaar

          Would putting the script in an external file and including it with $(Must_Include=filename) do the trick? That should prevent your users from seeing or modifying it. Or do the see execution of the script as well and have access to the log file?

            • Re: Managing Hidden Script
              David Wellman

              Hi Gysbert,

               

              I don't think using 'must_include' will help.

               

              We're trying to prevent customers from seeing the logic that is held in the load script, this is part of our IP and just as you would not give customers the source code for a product, we don't intend giving them access to the load script.

               

              Cheers,

              Dave

                • Re: Managing Hidden Script
                  Marcus Sommer

                  I could imagine that this could be done per macro-API. There are the methods GetCovertScript and GetCovertScript available which are unfortunately not further documented but the following code returned the hidden script which is protected with the password "isHidden":

                   

                  msgbox(ActiveDocument.GetCovertScript("IsHidden"))

                   

                  therefore I think it could be set, too although within a first try it didn't worked for me because anything with the syntax wasn't right - but I think if you played a while you will find the correct one.

                   

                  - Marcus

                    • Re: Managing Hidden Script
                      David Wellman

                      Hi Marcus,

                       

                      Many thanks for that, that works a treat.

                       

                      Using the SetCovertScript api call I can now:

                      - have all of my load scripts as 'unhidden' during development,

                      - they will be stored in external files which means that I can put them under source control,

                      - during my 'go live' process, I can run a program which concatenates all of my scripts, in order, into a single 'script' and then set it as the hidden script in my deployed qvw file.

                       

                      A couple of things for anyone else who wants to try this:

                       

                      The api call sequence that I used for this are:

                      OpenDocEx  - on this call it doesn't seem to matter which 'accessmode' I used, they all allowed me to do what I wanted.

                      SetCovertScript

                      Save

                      CloseDoc

                      Quit

                       

                      I also tried to issue multiple calls to SetCovertScript with the intention of placing my scripts into multiple tabs. This didn't work for me. After using the api calls the only script that was loaded was the one from the final call. For me this is not a problem and is why in the steps that I described above I included "concatenates all of my scripts, in order,".

                       

                      The script that is loaded can contain a tab name in it (on the first line) in the form of:

                      ///$tab Secret Load Script

                       

                      If this is present then the tab will be named as shown ("Secret Load Script").

                       

                      If the script doesn't have a '$tab' then it will be called 'Hidden Script'.

                       

                      I hope this proves useful to someone else.

                       

                      Cheers,

                      Dave