4 Replies Latest reply on Apr 7, 2014 12:36 PM by thomastudios

    Error when executing AppleScript

    thomastudios

      Title

      Error when executing AppleScript

      Post

           For many years I have maintained an ever-growing database in FM that tracks our household inventory.  It's been very handy when looking up purchase date, installation issues, and especially, accessing PDF manuals.

           Recently the manual launch stopped working where before it was absolutely flawless.  It no longer works in FM 12 Adv or 13.

           I have a field that contains a calculated AppleScript command.  When you click on the field label, it executes (or is supposed to) and opens the specific manual in Acrobat Pro. But lately I've been getting an error stating "an unknown token can't go after this identifier"  ?????  Then a second error dialog blurts out "Unknown error: -2740.  I cannot find this error anywhere online.

           The calculated script reads "Spring Rock Inventory::Manual 1" in the Specify Calculation window and this refers to the specific field where the AppleScript resides.  If I run the AS separately on its own, it runs perfectly.  But from within FM, it upchucks the two error dialogs.

           Any and all help would be most appreciated.

           J D Thomas
           ThomaStudios

            

        • 1. Re: Error when executing AppleScript
          RickWhitelaw

               I'm not sure I understand the notion of calling a field containing an AppleScript. Are you saying the field is a text file that contains the AS? Should you not be using the Script Step "Perform AppleScript"?

          • 2. Re: Error when executing AppleScript
            thomastudios

                 Yes.  The field is a text field that executes a calculated AppleScript.  It was setup using the "Perform AppleScript" step as you alluded to.  The field is merely the 'holder' for the script which is triggered by clicking on the field's label, which was formatted as a button to accomplish that.

                 As I said before, this worked up until recently, and I have made no changes to the file.

                 J D Thomas
                 ThomaStudios

                  

            • 3. Re: Error when executing AppleScript
              FentonJones

                    

                   I can just guess a couple of things I've run into, when moving from FM 11 to FM 12.
                    
                   1. Do you have an ".fp7" somewhere in the calculation for the AppleScript? If so, it needs to be changed to ".fmp12". (Obvious, but I ran into it more than once.)
                    
                   2. If you have both FM 11 running, and FM 12, an AppleScript, even if running from an FM 12 script step, may want to run it view FM 11. I do not specifically tell it which, so I ran into this problem (as it is better not to, as some people have just FileMaker Pro, and I run FileMaker Pro Advanced; so not saying exactly which lets it run on either). The answer, when running AppleScripts, was to only run one of the FileMaker applications at the same time.
                    
                   Unfortunately, I don't remember exactly what it told me when the above happened.
                    
                   There is an PDF file about AppleScript, named: AppleScriptLanguageGuide.pdf
                   [ Mine is from 2008-03-11, so may be old.]
                   If you don't have it, it must be somewhere on the Apple web site.
                   On page 235 (of mine) is the "Error Numbers and Error Messages"
                   -2740 : A <language element> can't go after this <language element>
                    
                   Which don't really solve it, does it? AS does not have the best results for errors.
                    
                   P.S. If at all possible I run tests of AppleScripts with the AppleScript Editor app. [ You must add the: tell applicatin "FileMaker Pro Advanced" (or "FileMaker Pro" instead).] The AS app is much better are show where your script does not work, as it will select the place where it had to stop. Of course you'd have to redo your AS (much) differently than a FileMaker calculation would be.
                    
                   * I just found the file at Apple. Mine is old. Newer one is at this site; the PDF button at the top right. Or just read it online.
              • 4. Re: Error when executing AppleScript
                thomastudios

                     Thanks Fenton.  I am using both FM Adv. 12 and 13, but neither runs simultaneously.  The AS is calling for a PDF, not a FM file, and there is no reference to a FM file in the AS.  So…

                     You're right.  As in most numeric message errors, they are of absolutely no help.

                     I swear this used to work before I installed Adv 13.  I am thinking of uninstalling 13 since there isn't much there that is all the compelling for me to have on board.

                     J D Thomas
                     ThomaStudios