2 Replies Latest reply on Jul 15, 2009 9:09 PM by edusouza

    Path to photos

    itsjoel

      Title

      Path to photos

      Post

      Please.

      How can I set up a path so that different files can correspond to different photos. There is a folder of photos.

      Thanks 

        • 1. Re: Path to photos
          etripoli
             Are you referring to importing photos, and displaying them in a FileMaker database?
          • 2. Re: Path to photos
            edusouza
              

            Hello, Itsjoel,

             


            itsjoel wrote:

            How can I set up a path so that different files can correspond to different photos. There is a folder of photos.

             


             

            I guess you want to reference a record with its correspondent file, am I right?

            If so, you may acquire a PlugIn (the Troi File PlugIn is excellent for such) or, if you are using Apple Macintosh running OS X 10.3.x and up, you may use Applescript for this task.

            Just for the sake of providing an answer for your problem, I'll assume you're using a Macintosh running OS X version 10.3.x or newer, and explain to you how to accomplish it using AppleScript.

            Here's a way to do it. In your FMP Solution: 

             

            • Create a new text field for storing the path (for this example, I'll call it photo_path)

            • Create a new script with the following steps:

             

            1. Perform Applescript (from miscellaneous)
            2. Paste  (from editing)

             

            • On the first step, you will insert your Applescript Code, and on the second one, you'll select the text field you've just created (photo_path) and check the options "Select Entire Contents," "Go to Target Field," and "Paste Without Style."

             

            The AppleScript could be something like:

             

            on open (path_to)

                 set curr_sel to result as alias

                 set path_to to (POSIX path of (curr_sel) as string)

                 set the_button to button returned of (display dialog path_to buttons {"Cancel", "Copy"} default button 2)

                 if the_button is "Copy" then

                      set the clipboard to path_to

                 end if

            end open

            on run

                 set path_to to (choose file)

                 set curr_sel to result as alias

                 set path_to to (POSIX path of (curr_sel) as string)

                 set the_button to button returned of (display dialog path_to buttons {"Cancel", "Copy"} default button 2)

                 if the_button is "Copy" then

                      set the clipboard to path_to

                      else

                      set the clipboard to "" 

                 end if

            end run

             

            When you perform the script from your solution, the Finder pauses FMP and presents you with a navigation window so you may choose a file. On the lower part of this window there are two options: "choose" and "cancel."

            After selecting the desired file and clicking on "choose," appleScript presents you with the path to be copied and two new options: "Cancel" and "Copy". By clicking on "Copy" (the default option), you copy the path data into the clipboard and allow FMP to resume the script, which will paste it from the clipboard into the field photo_path. If you click on the "Cancel" option, you will zero or clear the clipboard and -- when FM resumes -- the field photo_path as well.

            One more thing: the AppleScript above references a file. If you need it to reference a folder, send me a private message, and I will send you some examples.

            AppleScript is Apple's native scripting language, and has been part of Mac OS since version 7.1.1. It's a powerful tool for automation that allows many applications to interact with the Finder as well as to each other. If you're working on the Windows Platform, I believe you'll need to acquire the Troi File PlugIn.

            If you want to know more about AppleScripting, Macscripter is probably the best place to start; if you want to know more about Troi and their great plugins, visit their website.

            I hope my answer was helpful.

             

            Regards,

             

             

            E*