9 Replies Latest reply on Sep 11, 2015 3:55 AM by vtdonn

    Bulk photo export


      We need to write a script that will export the contents of a whole bunch of container fields (90+- photos) in FM Go. I cannot figure out how to specify the proper file path (or loop through all of the fields, but that's phase 2 of this issue).


      Do you need to first create a directory on the device to recieve the photos? If so, how do you create an empty directory in FM Go?

        • 1. Re: Bulk photo export

          FileMaker Go is sandboxed, and you can only really write to the existing documents or temp directories in Go. You can not run applescript or create directories on the device.


          Where are you sending those photos? EG what is your purpose for exporting them?

          • 2. Re: Bulk photo export

            Thanks Mike, the client ultimately wants to upload all the photos to their server. Its easy to so spreadhseet exports of their other data, but the photos have us stumped. I went through the manual method of uploading to dropbox through the FileMaker menu functions, but if we could automate that with a script (upload to dropbox)  that would also be a suitable solution. In fact, that would be a better solution.


            I seem to recall one of the guys stumbling onto a bulk container export function where all the .jpegs get dumped into a directory on the iPad, but maybe that was just on the desktop? No one can remember where/when we tested that.

            • 3. Re: Bulk photo export

              It would be much easier if you were hosting data on the server, you could just write a batch script that copies exported image data to a dropbox folder.


              Otherwise you can probably do it through the dropbox API and setting up your own RESTful web service to send the image to for upload. As far as native filemaker goes, at least automated I don't think there's any native way to do it on the iPad.

              • 4. Re: Bulk photo export

                Let's say we wanted to do this on the desktop. I have a simple script that works on one container at a time, but when I repeat that language on the second container it only exports the first one. Could someone steer me in the right direction?



                • 5. Re: Bulk photo export

                  Your paths are calculated oddly. can't you just do this instead:

                  Set Variable [ $PATH ; Get(DesktopPath) & "/Working/Steigerwaldt/Test/" & GetContainerAttribute( Points::S1BPIC ; filename ) ]


                  With the above you can also get rid of lines 3, 6 & 7 in your script.


                  Your calc is assuming that the container field extension is ALWAYS going to be ".jpg", whereas my calc above uses the actual filename and extension from the contained file itself.

                  • 6. Re: Bulk photo export

                    If I deleted line 3, then it wouldn't know the active field name in order to properly name the file upon export, right? I missed line 6 when I copy/pasted- sure that can go away. And doesn't line 7 serve the same purpose as line 3 to ensure that each field/image gets the proper name?


                    But the real question here is why it will only export the first field. Is there some other language I need to walk through each field? Or is this a limitation of the Export Field Contents script step?

                    • 7. Re: Bulk photo export

                      Why are you naming it after the field though? Don't you want the name of the image INSIDE of the container, not the container field's name? If you're exporting many images at once, you'd overwrite those two images every time and only ever wind up with two exported images.


                      GetContainerAttribute() was designed specifically to grab details about files inside of your record's containers. Your code doesn't protect against empty containers, or containers that have files other than ".jpg".

                      • 8. Re: Bulk photo export

                        This is a solution that is used on iPads, and then administrators deal with the data export and analysis. Each solution only contains a single site, and there are 90 photos for each site. So there is only one occurrence of each container field in the export. The file name that the iPad gives the image isn't relevant. What is relevant is the field name, so the administrators know what field the photo is associated with. I will add a line to protect against empty containers.


                        But getting back to the original question, so you know why it is only allowing me to export the first container field and it doesn't sweep through the rest?

                        • 9. Re: Bulk photo export

                          We figured out the problem. There was a script triggered on the layout when you exited the field, and that was causing the export script to halt. All set for now!