7 Replies Latest reply on Jan 4, 2017 10:55 PM by user19752

    Script Parameter from a button bar

    Kirk_1

      How do i get the scrpit parameter from a button bar?

       

      This button bar will be add or remove... how do i determine which it is to pass to the script?

       

      I can always do two scripts one for add then pass the add and one for remove and pass remove, but was looking for a more elegent way, if there is one.

        • 1. Re: Script Parameter from a button bar
          RickWhitelaw

          Specify the script you want to run then specify the optional script parameter. Nothing to do with "Add". Perhaps read up on script parameters.

          • 2. Re: Script Parameter from a button bar
            philmodjunk

            I think that there is confusion here between a button bar and a button located inside the button bar. Each button located inside the button bar is just a button object like any other on your layout and thus has the ability to be associated with a script parameter and a script like any other button.

            1 of 1 people found this helpful
            • 3. Re: Script Parameter from a button bar
              erolst

              Kirk_1 wrote:

               

              I can always do two scripts one for add then pass the add and one for remove and pass remove, but was looking for a more elegent way, if there is one.

              If you had two scripts you wouldn't need to pass script parameters to perform different code.

               

              You can use a single script like

               

              If [ Get ( ScriptParameter ) = "add" )

                # [ perform the add stuff ]

              End If

              If [ Get ( ScriptParameter ) = "remove" )

                # [ perform the remove stuff ]

              End If

               

              Now assign that script to each of the two button bar segments, but specify two different script parameters — namely, "add" and "remove".

              2 of 2 people found this helpful
              • 4. Re: Script Parameter from a button bar
                FileKraft

                you need to assign the script on each button of the button bar - unfort. no generic script assignment for the entire object - then assigning it you can decide what script parameter should be passed on each of the buttons ..

                • 5. Re: Script Parameter from a button bar
                  BruceRobertson

                  Yes, we've long needed an ability to pass as a script param "self".

                  "FileMaker: you know that thing I just clicked on? Use that as the script parameter."

                  But we're not there yet.

                  1 of 1 people found this helpful
                  • 6. Re: Script Parameter from a button bar
                    jbante

                    There are other schools of thought, here. If you have two operations you want to perform, you could have your two scripts for "Add" and "Remove", and don't you don't have to pass a parameter to either of them. The result is two scripts instead of one, but both scripts and both buttons wind up being simpler.

                    • 7. Re: Script Parameter from a button bar
                      user19752

                      Now only(?) tab control can Get() active object in trigger script (so you don't need parameter), it can be workaround for this thread.

                       

                      Self can get the label of button when used in conditional formatting or hide when calculation, but it is not when clicked of course...

                      1 of 1 people found this helpful