9 Replies Latest reply on May 14, 2010 4:26 AM by disabled_Ed-Case

    FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error

      Summary

      FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error

      Description of the issue

      This exact applescript works fine under OS 10.4 or earlier, but won't work using 10.6 on any computer. I have tried it on three computers - iMac, Mini, MacBook in very simple and much reduced terms this is what it says: set TheImage to "images:imagefolder:ABC123AA.jpg"tell application "Filemaker Pro"set cell "Preview" of record i of window "PhotoList" to file TheImageend tell Preview being a container field. As I say, this works fine on macs running 10.4 or earlier, but returns an error message with 10.6:Result:error "FileMaker Pro Advanced got an error: Object or property is the wrong type." number -10001 to item I have even amended the script to first ask Finder if the file exists - and it returns "true". I know that 10.6 can be a bit case sensitive, which I originally thought might be the case. ThanksCS 

        • 1. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error
          TSGal

          Ed-Case:

           

          Thank you for your post.

           

          There were a number of changes to AppleScript in Snow Leopard (Mac OS 10.6.x).

           

          If you substitute the whole path name rather than using "TheImage", does it work?

           

          Anybody else having this difficulty?

           

          TSGal

          FileMaker, Inc.

          • 2. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error

            Thank you for the reply.

             

            Okay, so the reason for the use of the variable TheImage is that the path and file name are in the filemaker database to which the image is to be added to the Preview container field. But no matter, I tried this:

             

            setcell "Preview" ofrecord i ofwindow "PhotoList" tofile ("images:" & (cell "imagepath" ofrecord i ofwindow "PhotoList") & ":" & (cell "File Name" ofrecord i ofwindow "PhotoList"))

             

            and even this

             

            set cell "Preview" of record i of window "PhotoList" to file "images:imagefolder:ABC123AA.jpg"

             

            Both elicit the same response: error "FileMaker Pro Advanced got an error: Object or property is the wrong type." number -10001 to item

             

            I know Apple have made changes to some aspects of Applescript, but cannot find a way of getting this to work. It seems Filemaker is identifying the item as something other than a file that is acceptable to a container field. Strange but true.

             

            This isn't a panic query, as I still maintain sufficient Macs running OS 10.4.X to do the business. However, there will inevitably come a time when I will wish to use my FM 11 licences when all my old Macs have died and gone to computer heaven. I can't even tell you whether this script works with 10.5 (Leopard), because Apple supply new computers that can only be run using the latest operating system (10.6.X) - an operating system with which I have already had more my fair share of hair greying problems.

            • 3. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error
              TSGal

              Ed-Case:

               

              Thank you for the additional information.

               

              Looking on FMForums.com, I did find a post by Fenton Jones (who is also a member of this forum) that applies.  Please see:

               

              http://www.fmforums.com/forum/showtopic.php?tid/213744/

               

              TSGal

              FileMaker, Inc.

              • 4. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error

                Thanks, I have read the suggested reference. However, I am already familiar with that method, which I employ to embed thumbnail images from a single folder - since as the correspondent points out, one cannot (easily) embed an image in a container field by using applescript, unless one has a scripting addition that can read the raw image data to a variable and write it to the field. Well, that's what I used to do back in the days of OS 9.

                 

                However, I much prefer the direct means of going to a record, acquiring the path from a field and applying that path as an unstored image in a container field.

                 

                I don't wish to be a member of the awkward squad and, as I previously mentioned, this is not an urgent request, however... in the AppleEvents database that accompanies all versions of Filemaker post version 7 it references the tried and tested means. vis.

                 

                ... set cell 'Image" of current record of window "MyDatabase" to file "Image.jpg"

                 

                I was rather hoping for an answer that reflects Filemaker's advertised method, as opposed to a clunky workaround that offers none of the assurances of applescript.

                 

                Thank you again for your assistance.

                 

                CS

                • 5. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error
                  TSGal

                  Ed-Case:

                   

                  I have forwarded all of your posts to our Development and Software Quality Assurance (Testing) departments for review and comments.  When I receive a reply, I will let you know.

                   

                  TSGal

                  FileMaker, Inc.

                  • 6. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error
                    TSGal

                    Ed-Case:

                     

                    Our Testing department has confirmed this problem does exist with Snow Leopard with FileMaker Pro 9 and FileMaker Pro 10.  However, it works correctly in FileMaker Pro 11 (with Leopard and Snow Leopard).  This issue has been sent to Development.

                     

                    TSGal

                    FileMaker, Inc.

                    • 7. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error

                      I will check this out using Filemaker 11 and if it works correctly will be happy to call it quits.

                       

                      My reason for using v.9 as opposed to 10 or 11 is simple and entirely to do with the repositioning of the status area.

                       

                      Having spent an inordinate amount of time adjusting layouts and window sizes to ensure an even number of records are displayed in list view, I was rather disappointed to discover that I would need to conduct the same exercise anew to ensure the same results in 10 or 11, now the status area has been moved from the side to the top. This felt slightly illogical, in that the vast majority of screens (and 100% of ours) are landscape orientated, meaning that the status area occupies more than its fair share of vertical space, thus diminishing what we all want, which is to view the actual database records.

                       

                      In my naive optimism I was hoping that sufficient users shared my views to encourage Filemaker to maybe provide a means of applying a 'classic' look to 11, whereby the status area could be placed either at the side or the head, according to taste and preference. Sad to say that I never heard back from Filemaker regarding this (oft repeated) suggestion. A simple 'no' would have sufficed. Probably, a somewhat forlorn hope, at best.

                      CS

                      • 8. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error
                        TSGal

                        Ed-Case:

                         

                        Our Testers was able to get this to work under FileMaker Pro 9 and 10 by doing:

                         

                        set TheImage to "Image:/MCP/Users/<user account>/Documents/ABC.jpg"

                        tell application "FileMaker Pro Advanced"

                           set cell "Preview" of record 1 of window "Untitled" to TheImage

                        end tell

                         

                         

                        Let me know if this works for you.

                         

                        TSGal

                        FileMaker, Inc.

                        • 9. Re: FMP 9.0v3 Mac OS 10.6 using applescript to insert image into container field returns error

                          Yes, that works. You need to use something like this though:

                           

                          "imagemac:/Macintosh HD/Users/me/Desktop/imagefolder/ABC123YZ.jpg"

                           

                          it only works for me using the syntax "imagemac:/" as opposed to "image:/"

                           

                          Thank you, I appreciate all the effort to resolve this particular problem with Snow Leopard and Filemaker. Case closed.

                           

                          CS