5 Replies Latest reply on Dec 1, 2011 9:02 PM by John_1

    Scripting question

    John_1

      Title

      Scripting question

      Post

      I wrote a script to open documents /layouts. I placed an edit field (Document list) and a superimposed button with a script. See script screenshot. I want to be able to click the button, then choose a document (layout) then automatically go to the layout. I think I am missing something. I tried to remove the pause/resume and this made it worst. I am trying to minimize clicking. I want to click, choose from pop op menu or list and automatically go to the layout. Any help? thanks in advance.

      script.JPG

        • 1. Re: Scripting question
          LaRetta_1

          Hi Sal,

          If you have a field which holds your layout names (it should be a global field), then you can use that value to switch layouts using that value by using Go To Layout [ by calculation ].  This calculation can refer directly to the global field itself if the value in the global matches a field name, or the calculation can become more complex, similar to:

          Case (
          TVGI::Status = "Pending" ; "Pending" ;
          TVGI::Status = "Completed" ; Final Screen"
          )

          You can use script trigger OnObjectModify to trigger the script when User makes selection.  BTW, Clear[] normally is not used; Set Field[] is the preferred step.  So if your script is simply to choose a layout name in a pop-up global and then go to that layout, it would be simple:

          Go To Layout [ global field ]

          If you are using version prior to script triggers then we need to know whether you are Mac or Windows and what FM version you are using.  Scripted pop-ups behave differently depending upon OS.

          • 2. Re: Scripting question
            philmodjunk

            Just to help you understand what your current script does and how/why it fails:

            Allow User Abort [on] --this step allows users to press Esc (windows) or command-period (mac) to halt your script before it completes running. Since this is the default setting, it does nothing here. (Allow user abort [off] prevents users from halting a script and this option would remove the cancel button that appears when the script is paused if you had selected off instead of on.)

            Clear [Select ; TVGI::DocumentList ] -- if this field is present on the current layout, all contents of this field are deleted. If it is not on the current layout, nothing happens.

            Set variable [$Layout ; value: TVGI:::DocumentList ] --this copies the contents of the field into a variable, but since the previous step has most likely cleared this field, there is nothing to copy and the variable will be empty.

            Go to Field [TVGI:::DocumentList ]--this puts the cursor in the documentList field--which is currently an empty field...

            Go to layout [$Layout] -- if you have specified "layout name by calculation" option, this will take you to the layout whose name is stored in $layout, but if $Layout is empty due to the clear step, it does nothing.

            Pause/resume [indefinitely]---pauses your script until you click continue or cancel in the status area

            Go to layout ["Quick File Cabinet" (TVGI)] --takes you to the layout named "Quick File Cabinet".

            • 3. Re: Scripting question
              John_1

              Thanks for the advice. I am a newbie and have been learning from reading your posts and FM books. I was able to simplify the script but I was not able to fine OnObjectModify script trigger. I have FM pro 11 and I am using windows 7. Any advice?

              • 4. Re: Scripting question
                philmodjunk

                ENter layout mode. Select the field by right clicking it. Select 'Script triggers' from the menu that pops up.

                • 5. Re: Scripting question
                  John_1

                  Thank you phil. That's how you can tell how novice I am.