3 Replies Latest reply on Feb 11, 2013 9:00 AM by philmodjunk

    Export Multiple Pictures with file naming convention

    cschul

      Title

      Export Multiple Pictures with file naming convention

      Post

           Hi,

           I'm trying to figure out how to export multiple pictures from the one entry. I need the filenames that are being exported to match the ID field, but to have a number added to the end. I have a max of 7 pictures. 

           I have seen the forum entry that allow for one picture.

        • 1. Re: Export Multiple Pictures with file naming convention
          philmodjunk

               are these 7 fields in one record or do you have a realted table with one container field in each related record?

               Either way, export field contents can be used to export the data, but the scripted details will vary.

               The following script example exports two picture files of type jpg to the user's desktop with the name stored in ID, but with a number appended:

               Set Variable [$Path ; Value: "File:" & Get ( DesktopPath ) & YourTableIDfield & "1.jpg"]
               Export Field Contents [YourTable::YourContainerField1 ; $Path ]
               Set Variable [$Path ; Value: "File:" & Get ( DesktopPath ) & YourTableIDfield & "2.jpg"]
               Export Field Contents [YourTable::YourContainerField2 ; $Path ]

               This can be extended easily to export from 7 different container fields in the current record.

               If they are from related records, your script can loop through the set of related records, exporting each and using a variable incremented by 1 with each pass through the loop to export any number of picture files.

          • 2. Re: Export Multiple Pictures with file naming convention
            cschul

                 Thanks! That worked for the most part. I just had another question. How would I competence for the different file extensions of the pictures? I have pct, gif, and jpg. I tried the Right command without any success. I would do it manually however I have over 50,000 pictures.

            • 3. Re: Export Multiple Pictures with file naming convention
              philmodjunk

                   You can extract the original file name from the container field using this calculation:

                   This should work for all insertion and storage methods except the Insert Object option found in Windows FileMaker 11 or older:

                   Let ( [T = GetAsText ( GetValue ( YourTable::containerField ; ValueCount ( YourTable::containerField ) ) ) ;
                               L = Length ( T )];
                               Right ( T ; L - Position ( T ; "/" ; L ; -1 ) )
                       )

                   You can modify that to get just the file extension if you want.jpg:

                   Let ( [T = GetAsText ( GetValue ( YourTable::containerField ; ValueCount ( YourTable::containerField ) ) ) ;
                             L = Length ( T );
                             fname =  Right ( T ; L - Position ( T ; "/" ; L ; -1 ) ) ];
                             Right ( fname ; Length ( fname ) - position ( fname ; "." ; 1 ; 1 ) + 1 )
                       )