7 Replies Latest reply on Apr 12, 2013 4:40 PM by listen2earth

    How to "DO Script" From A Field and Forget if statements

    listen2earth

      H E L L O ——

       

       

      SIMPLY—

       

      "HOW"?

       

      To run a script from a field.

       

      Apple script:

       

      do script fileMaker script "scriptName"

       

      does the script but i want to run ANY

      script name i put in my field.

       

       

      the field has to be formatted just right?

       

       

      thanks

      for

      your

      attention

       

      HEARTLAND AMERICA

        • 1. Re: How to "DO Script" From A Field
          rgordon

          Do you have to do this with Apple Script?  A script trigger could also do what you want.  Create a pop up menu with all the scripts you want to be able to select.  Then trigger an on modify script that has a series of if statementst to determine with script to run.  A script trigger will work on a Mac, Windows and Ipad/iPhone.

          • 2. Re: How to "DO Script" From A Field
            listen2earth

            EASIER to stay with Do Script!!

             

            Cause i have a unique Button designs.

            i want to perform various task from limited buttons.

             

            So i need to set a field — putting different script names into that field.

             

            this is what has been working for me over the years put together

            with scotch tape but i am tried of looking at all the scotch tape:

             

             

            SET THE DO SCRIPT FIELD STORED IN VARIABLE:

             

            If ( $scriptNAME >""

             

            set the field thats going to run the script and set this symbol  (s) which will get replaced with quotation marks later using the substitute command:

             

            set field ( FormatRUNscript ; "(s)"& $scriptNAME &"(s)"

             

            use substitute command replacing this symbol   (s).

             

            set field ( FormatRUNscript ;   "do script" & HOME::FormatRUNscript

             

            DOSCRIPT THAT PERFORMS THE MENU ACTION:

             

            perform AppleScript (calculated) ( HOME::FormatRUNscript)

             

            end if

             

             

            the problem is the formating

             

            thanks

            • 3. Re: How to "DO Script" From A Field
              listen2earth

              ps... even if one did use a script trigger like you suggested

               

              it would be better to use AppleScript DO SCRIPT in which

              every popup script name woud simply GO / RUN without

              using ANY if Statements ;-)

              • 4. Re: How to "DO Script" From A Field
                IT_User

                There a couple of formatting things you can do in FileMaker that I can suggest. I can't say anything aobu the DO SCRIPT, though.

                 

                If ( $scriptNAME >""

                Change the if statement to:

                If ( Not IsEmpty ( $scriptNAME ) )

                 

                set field ( FormatRUNscript ; "(s)"& $scriptNAME &"(s)"

                 

                use substitute command replacing this symbol   (s).

                It may work better if you do use a backwards slash and quotation, like:

                set field ( FormatRUNscript ; "\""& $scriptNAME &"\""

                rather than using substitute for " to replace (s).

                 

                set field ( FormatRUNscript ;   "do script" & HOME::FormatRUNscript

                Maybe you need to add a space in the "do script " to make sure they are separate.

                 

                And I think you can do something with script triggers that perform AppleScript DO SCRIPT that can detect the field name or data.  It can be collected and possibly passed as a variable.  Depending on how you want to do it, makes a difference how you want it set up.

                • 5. Re: How to "DO Script" From A Field
                  listen2earth

                  THANKS !!

                   

                  that rids some scotch tape!

                   

                  HERE ARE MY SCRIPTER NOTES:

                   

                  IT ELIMINATES IF STATEMENTS FOR BUTTONS.

                   

                  I ALSO RUN SCRIPTS STORED / ORGANIZED IN A SCRIPT LIBRARY ALSO A FIELD DEFINITION LIBRARY.

                  Which helps manage scripts and field when having a lot of them. Using ..

                   

                  ScriptNames (fileName )

                  FieldNames ( fileName ; layoutName )

                   

                  In any case..

                  the better formatting works:

                   

                  S T E P S

                  set variable ( $SCRIPTname; Value; IMAGEsource::formatRUNscript )

                  #

                  if ( not IsEmpty ( $scriptNAME )

                   

                  #format the field with script name

                  set field ( "do script" & "\""& IMAGEsource::formatRUNscript &"\"" )

                  #

                  #DOSCRIPT FROM FIELD — perform the action from script trigger or from any other functionalities

                  Perform AppleScript ( IMAGEsource::formatRUNscript )

                   

                  end if

                   

                  works good in various popups not needing any if statements.

                  Also i have one button that rotates menu names on the button with  pause / continue to next menu.

                  Rotating the menu with the enter key. When i have the button menu i want  i press the GO Button !!

                   

                   

                  thanks again for your attention and time !!!

                   

                  i edit my post for better clarifications. sorry about that !!!  Have good day !!!

                   

                  rob 'jesus Land Tidd' lewis


                  Structures From Silence — Earths Dynamic Air Waves Changes All

                   

                  Message was edited by: listen2earth

                  • 6. Re: How to "DO Script" From A Field and Forget if statements
                    listen2earth

                    here is more details (as i am thinking out loud)

                     

                     

                                                     HOW TO HAVE A SINGLE BUTTON ROTATE MENUS.

                     

                     

                    FIRST ITS A GOOD IDEA TO HAVE ALL SCRIPT NAMES INTO A DATABASE / LAYOUT FOR BETTER MANAGEMENT:

                    ScriptNames (fileName )

                     

                     

                     

                    1 FIELD (ScriptName) STORES SCRIPT NAMES

                    OTHER FIELD (ButtonMenu) STORES THE NAME TO BE DISPLAYED ON THE BUTTON.

                     

                     

                    SCRIPT STEPS NELOW SHOWS FOUR MENUS THAT ROTATES A ONE BUTTON:

                    displays Menu while having access to its Script name:

                     

                     

                     

                    goto    record ( displays ButtonMenu  - has script name for it )

                    pause

                    goto another record ( displays ButtonMenu  - has script name for it )

                    pause

                    goto another record ( displays ButtonMenu  - has script name for it )

                    pause

                    goto another record ( displays ButtonMenu  - has script name for it )

                     

                     

                     

                     

                    When i have the button menu i want i press 'GO' which activates this script:

                     

                     

                     

                     

                    set variable ( $SCRIPTname; Value; IMAGEsource::formatRUNscript )

                    #

                    if ( not IsEmpty ( $scriptNAME )

                     

                     

                    #format the field with script name

                    set field ( "do script" & "\""& IMAGEsource::formatRUNscript &"\"" )

                    #

                    #DOSCRIPT — perform the menu action from script trigger or from any other functionalities

                    Perform AppleScript ( IMAGEsource::formatRUNscript )

                     

                     

                    end if

                    • 7. Re: How to "DO Script" From A Field and Forget if statements
                      listen2earth

                      THIS IS CONTINUED.

                       

                      SEE MY POST  CALLED ..

                       

                      Perform Scripts From A Field - Avoid IF Statements part II

                       

                       

                      i have been long avoiding the long lines of “if statements”.