5 Replies Latest reply on Jul 26, 2012 4:47 AM by Malcolm

    Applescript Filemaker Resources?

    Malcolm

      I've just realised that my Filemaker / AppleScript skills have rusted solid. I have some AppleScript resources. Would someone point me to Filemaker specific examples?

       

      thanks

      Malcolm

        • 1. Re: Applescript Filemaker Resources?
          gdurniak

          Applescript is a pain. Even if you find a reference, it's still often trial and error

           

          I usually just Google "filemaker applescript", with whatever command I'm interested in

           

          Stackoverflow offers some good advice

           

          greg

          • 2. Re: Applescript Filemaker Resources?
            fmsimplicity

            What are you trying to accomplish?

            • 3. Re: Applescript Filemaker Resources?
              Malcolm

              What are you trying to accomplish?

               

              A general toolkit for asking questions about the database similar to the Design Functions. How many tables, what are their names, how many fields, what are their names & IDs, etc.

               

              I simply wanted to grab field info from tables. I have two tables. One is a  duplicate of the other. The original has had many changes and I want to synch them to the duplicate.

               

              When I posted I couldn't get past this:

              tell app "filemaker" to get name of every table of database 1 --> object not found

               

              I finally discovered this method:

               

              tell app "filemaker" to set tbl_ids to get id of every table of database 1 --> {1,2,3.....}

              set tbl_names to {}

              repeat with i from 1 to count

                  tell app "filemaker" to set end of tbl_names to get name of table id (item i of tbl_ids) of database 1

              end

               

              Malcolm

              • 4. Re: Applescript Filemaker Resources?
                sporobolus

                on 2012-07-25 18:58 Malcolm wrote

                When I posted I couldn't get past this:

                tell app "filemaker" to get name of every table of database 1 --> object not found

                 

                tell application "FileMaker Pro Advanced" to get name of tables of database 1
                

                 

                or, to make more clear the order of operations:

                 

                tell application "FileMaker Pro Advanced"
                   tell database 1
                     name of every table -- or, name of tables
                   end tell
                end tell
                

                 

                this is more about AppleScript than about FileMaker; beware the temptation to

                expect an AppleScript statement that compiles and sounds reasonable in English

                sentence to just work; the way AppleScript executes your example, "every table"

                returns a list of table objects, then you asked for the name of that list …

                 

                if you can justify the cost, Script Debugger makes it very comfortable to

                explore the object model of an app like FileMaker

                • 5. Re: Applescript Filemaker Resources?
                  Malcolm

                  Hi Steve,

                   

                  Thanks for the neat code. My post shouldn't have been so sloppy, I didn't cut and paste and I didn't signal that I was typing pseudo-code.

                   

                  I found the work-around with IDs but I guess that by that stage I'd corrected whatever syntax error there was when I was asking for names.

                   

                  I'm working with Smile, which meets my needs nicely. I worked with Script Debugger a few years back when I was doing a lot of AppleScripting and would pay the price immediately if I had to do more than a few quick one liners.

                   

                  Malcolm