3 Replies Latest reply on Dec 9, 2013 7:20 AM by TSGal

    Running Script from Portal Row



      Running Script from Portal Row


           Hello all-

           Maybe someone can help me figure this out.  I am designing a home automation controller with Filemaker Go to control Perceptive Automation's Indigo server software.  Since FMGO cannot directly execute applescripts on the host machine, I have devised a way for FMGO to make http calls using variables that will call the applescripts inside the Indigo Server.  So far so good.

           I related two tables-my primary control surface table "Indigo" and a table called "albums" that is an import of my iTunes XML.  I have a portal set up on an "Indigo" layout that correctly lists all artist/album combinations in my iTunes library.  I then wrote a script that does the following:

           When a portal row is clicked, the related record from "albums" is loaded, the "album" field is copied and pasted back to the original layout into a field called "albumtoplay" in the "Indigo" table.  A web viewer is then set to make the proper http call to the Indigo server software.  Here, I have an applescript that pulls the "albumtoplay" data from the current record of Filemaker Pro, and plays it in iTunes.  Long story short, the script works perfectly from Filemaker Pro, does not work from Filemaker Go.  I can see that the "albumtoplay" field is being set correctly in FMGO, but then the script seems to die.

           Any thoughts as to why a portal would not be able to execute this type of action in FMGO?  As an added note, if I assign a button on the "Indigo" layout to start the script after the "albumtoplay" field has already been filled, the script executes properly on FMGO.  It seems to be some problem with the portal, or going to a related record prior to execution.

           I'm sorry if this is convoluted, I don't know how to explain it better.  Hopefully someone can figure this out.  Much appreciated.

        • 1. Re: Running Script from Portal Row

               First an observation:


                    the "album" field is copied and pasted back to the original layout into a field called "albumtoplay" in the "Indigo" table.

               To move data from one location to another does not require the copy and paste script steps, you can use Set Variable in place of copy and set field in place of paste. While not as big an issue in the iOS environment, copy will destroy any data that the user may have previously copied to the clipboard and the set variable/set field steps will avoid doing that.

               This doesn't sound like the portal is actually a factor in this.

               Try adding a commit records step after setting the albumtoplay field and see if that makes a difference.

          • 2. Re: Running Script from Portal Row

                 I corrected the copy/paste and replaced with set variable and set field.  I also tried adding a commit records step with no success.  Any other ideas?  Thanks.

            • 3. Re: Running Script from Portal Row

                   Mike Drennan:

                   Thank you for your posts.

                   Where is the script not working?  Do the variables get set?  For debugging purposes, try adding some global fields as they act like variables, and set the global fields to the values from the desired fields.  This may point to which fields are not being accessed properly.

                   FileMaker, Inc.