1 2 Previous Next 23 Replies Latest reply on Apr 16, 2013 5:25 PM by rgordon

    Scripts From A Field

    listen2earth

      Letter To The FileMaker Community Forum

      Perform Scripts From A Field Avoid IF Statements part II

       

       

       

      i use ScriptNames ( Get ( FileName ) )

       

      i simply store my scripts in a database. Makes better for organizing sorting scripts. But most importantly i can access them, run them from my global field any place in my solution without the if statements.

       

      when certain conditions are met from few calculation steps which gives results then along with every result there is attached a script name which will appear in my global field formatted ready for activation.

       

      set field ( "do script" & """& HomeScreen::formatRUNscript &""" )

       

      if not isempty ( formatRUNscript )

       

      perform AppleScript Do Script “formatRUNscript”

       

       

      And it works great however it appears the AppleScript Do Script will not perform until a FileMaker script is completed is why i cannot get it to work from inside a Loop.

       

      i think this is SO SIMPLE that i am over looking something ?

       

      Maybe i should simply use AppleScript Command Lines that runs a script from a cell, instead of formatting a field to do a Apple DoScript ?

       

      i do not want to wait for my FileMaker script steps to complete to have any of my Apple DoScript activate.

       

      activating my scripts without if statements all works fine outside my Loop and when theres no problem having not to wait for a FileMaker script to complete before the DoScript goes.

       

       

      Again maybe i need AppleScript Command Lines — something like .. well i don't know ..

       

      tell application "Filemaker Pro"

      do script from cell "HomeScreen::formatRUNscript"

      end tell

       

       

       

      thanks for YOUR ATTENTION

       

      _________________________________

      Structures From Silence — Earths Dynamic Air Waves Changes All

        • 1. Re: Perform Scripts From A Field - Avoid IF Statements part II
          IT_User

          I don't know much about Applescripts.

          I only played with one script.

          It does process while the FM script is running, when being put into a loop.

           

          So it may have something to do with your DoScript not having time to process? I don't know.  Possibly include a delay so it does have time.

           

          How do you have your loop structured?

          • 2. Re: Perform Scripts From A Field - Avoid IF Statements part II
            AlanStirling

            Hi Robert

             

            I can understand the issue that you are experiencing, having come across exactly this situation in the past, and there is a simple explanation for it.

             

            All FileMaker Pro client software products are single threaded.

             

            FileMaker cannot handle user interaction from two inputs at the same time - it only has one input channel.

             

            Your script is running in a loop, taking over the single input channel, so when you call your AppleScript, FileMaker is busy and can't respond.

             

            Once the loop has finished running, then the channel is open for AppleScripts (or direct user) input.

             

            If you are intent in running this loop, then you have to construct it in a different way.

             

            You have to let the FileMaker script directly call your AppleScript and write the loop in your AppleScript, allowing the calling FileMaker Script to complete before the AppleScript starts.

             

            Once the AppleScript has control, it can call FileMaker Scripts, because AppleScript understands it has to wait for them to complete, before continuing execution.

             

            So you need to look at the problem from the point of view of AppleScript, which is controlling FileMaker, rather than the other way round, which you are doing now.

             

            I also politely suggest that you needed to make it clearer, earlier in this thread that most times you used the word 'Script', you were talking about AppleScript and not a FileMaker Script. Only by providing us all with unambiguous information, can we be expected to resolve your issues with the minimum number of exchanges.

             

            Best wishes - Alan Stirling, London UK.

            • 3. Re: Perform Scripts From A Field - Avoid IF Statements part II
              listen2earth

              Alan !          Thanks !

               

               

              Sorry about my terminolgy.

               

              Yes i felt it something to do with ...

              one can't GO unless one is STOP.

               

              ok... so i am going outside FileMaker

              when wanting to accomplish my routine

              inside FileMaker.

               

              So  i m on the wrong path ?

               

              There seems specifically, "only two paths here" ?

               

              And the first path is to get it to work all inside FileMaker

              and forget AppleScript.  i am not interested at this time

              in getting invoved with source codes outside FileMaker:

               

              so, sounds like i should forget using FileMakers AppleScript Do Script

              step and find another way to RUN my scripts from FileMaker field.

               

              Running all my IF Statements / scripts from field works of course outside

              my Loop Structures.

               

              After what you confirmed and at this time, i am still Teeter Tottering

              which way to go ?  if i incorporate using AppleScript then i should see

              if i can find AppleScript code that can somehow break FileMakers

              thread, do the script and simply return to where it left off in the thread ?

               

              hummmm ... much to think about.

               

              rob 'jesus Land Tidd' lewis

              Hard-Software Visionary

               

               

              Structures From Silence — Earths Dynamic Air Waves Changes All

              • 4. Re: Perform Scripts From A Field - Avoid IF Statements part II
                listen2earth

                i think possibly this is some bad programming of FileMaker !

                 

                in which FileMaker should have better cooperation of handling / controlling Script Executions.

                 

                Employing the FileMaker controls for script stack management when launching scripts via buttons.

                An argument accepted by the Perform Script [ ] button command controls the fate of any currently running script

                when the new script begins, providing you with the option to halt, exit, resume, or pause the current script.

                 

                If FileMaker can have all this script management then also FileMaker

                can better manage how to handle the execution of a AppleScript.

                 

                Manage Scripts provides a meta-command framework —  a series of script commands that give you control

                of the way other commands are executed. Using these process controls enables you to set up scripts

                to repeat (that is, looping and recursion ) or to conditionally omit or insert sequences of commands within a process.

                 

                So i think .. theres a flaw here with FileMakers interaction with external code.

                 

                USING CONDITIONAL STATEMENTS

                 

                We always require our one main script to perform the same sequence of actions — consistently and uniformly.

                However as our databases evolves we want more and more, set up, of scripts that take account of different circumstances and respond accordingly.

                 

                Personally i think FileMaker should very well consider "Loop Handlers"  and "Idle Handlers  !

                • 5. Re: Perform Scripts From A Field - Avoid IF Statements part II

                  And personally I think you should use black text and not produce repeated entire posts in obnoxious colors. 

                   

                  I also think you should at least learn what you are doing in FileMaker ( would requires a LOT more time and effort than you've given ) before you blast FileMaker for faults ( complete lack of understanding ) which YOU posses.

                  • 6. Re: Perform Scripts From A Field - Avoid IF Statements part II
                    listen2earth

                    its hard for me to mark this as the Correct Answer

                    • 7. Re: Perform Scripts From A Field - Avoid IF Statements part II

                      That's okay if you can't mark my post as the correct answer.  Points do not ( and never have ) motivated me.  In fact, sometimes speaking out is worth 1,000 MINUS points as in this case. ;-)

                      • 8. Re: Perform Scripts From A Field - Avoid IF Statements part II
                        DavidJondreau

                        Who knew the Singularity would be FileMaker-based?

                        • 9. Re: Perform Scripts From A Field - Avoid IF Statements part II
                          listen2earth

                          well .. i have to admit,

                          i do things entirely different

                          from the general stream.

                           



                          • 10. Re: Perform Scripts From A Field - Avoid IF Statements part II
                            listen2earth

                            my scripts in up in Value List.

                             

                            When certain criteria and conditionals are met

                            then that value list for specific scripts are activated.

                            • 11. Re: Perform Scripts From A Field - Avoid IF Statements part II
                              listen2earth

                              What do you mean ?

                               

                              You actually had a Filemaker OSX script step called AppleScript Do Script perform, while from inside a loop without having to exit first ?

                               

                               

                               

                               

                              Robert

                               

                               

                              STRUCTURES FROM SILENCE --Earths Dynamic Airwaves Changes All

                              • 12. Re: Perform Scripts From A Field - Avoid IF Statements part II
                                listen2earth

                                OK  HERES A SUMMARY OF EVERYTHING IN THIS POST

                                 

                                 

                                i want to avoid IF Statement's.

                                 

                                My scripts names get set into a global as a list. i cycle through this list. In a Loop.

                                 

                                There's only one IF statement for activating any one of multiple scripts and that is .. IF i select one of the script names from the global field.

                                 

                                Filemaker script step, perform script does not allow you to run a script name that's in a field .

                                 

                                i want to say...

                                 

                                Perform script [ NAMEofFIELD ]

                                 

                                Filemakers script step AppleScript can do it using a calculated AppleScript ...

                                 

                                Perform script [ NAMEofFIELD ]

                                 

                                As long as the calculation formats it inside quotations.

                                 

                                But it's inside a Filemaker loop. And won't execute !!

                                 

                                i have to exit loop and complete the currently running script before Filemaker executes Her calculated AppleScript.

                                 

                                Literally months !!! Months stuck on this problem !!

                                 

                                ______________________________________

                                 

                                Alan Stirling advice hits it right on the head !

                                 

                                FileMaker Pro is single threaded.

                                 

                                Your script is running in a loop, taking over so FileMaker's Calculated AppleScript can't respond.

                                 

                                ______________________________________

                                 

                                Appears i shoud not be using FileMakers Calculated AppleScript Step. In order to stay in Loop.

                                 

                                i did find 360Works.com has a plugin called ScriptMaster.

                                 

                                ScriptMaster's 'Call Script Immediately' module will allow you to execute a script

                                based on the value in a field, and in combination with OnObjectModify

                                it will allow you to execute scripts without hardcoding script names.

                                 

                                ______________________________________

                                 

                                Sounds like this may work !!

                                ______________________________________

                                 

                                But my other option is to simply restructure my script sequences:

                                exit Loop

                                perform the AppleScript ( do the task)

                                return to Loop.

                                 

                                ____________________________________

                                 

                                sorry i am so esoteric ... high above the normal main stream of things.

                                Fortunately i not have to relate to it cause i am retired.

                                 

                                my solution "The  IAM PROGRAM NAVIGATION" concepts is a personal Homebase spiritual inspiration

                                i been working on over many years tired of Window and mouse navigations.

                                 

                                feel free to use or alter my files.

                                 

                                i only wish FileMaker would let you  perform script ( FieldName ).

                                 

                                robert

                                • 13. Re: Perform Scripts From A Field - Avoid IF Statements part II
                                  rgordon

                                  Robert, I agree that perform script by a calculation would be a nice feature.  What I don't understand is why such an aversion to If statements.  Instead of spending months on something that doesn't work, you could write a script in less than 5 minutes with one If statement and 13 Else If statements to make your solution work.  You would also get the added benefit of using it on Macs, iPads and PCs instead of just Macs.

                                  • 14. Re: Perform Scripts From A Field - Avoid IF Statements part II
                                    listen2earth

                                    Thank you rGordon for this consideration.

                                     

                                    why ? Because i use this in many other Loop sequences.

                                     

                                    if I started using IF Statements in one area then have to apply

                                    it in all my other areas. Yea there's always the call to use

                                    IF Statements where they are needed for one shot areas but

                                    when multiple lines of  IF Statements are called for and in many

                                    areas then another approach is needed . Thanks

                                     

                                    rob

                                    1 2 Previous Next