7 Replies Latest reply on Apr 26, 2010 9:25 AM by philmodjunk

    Using the 'Insert Picture' command in a script...

    paintboothguy

      Title

      Using the 'Insert Picture' command in a script...

      Post

      Hello All, 

      I am having trouble with the script command 'Insert Picture'.  Here is what the script looks like:

       

      Insert Text [Select; Quotes::Booth Info; all of my desired text is here and this part works well........"]

      Insert Picture ["dustdevil_isometric FM.jpg] 

       

      The result is a blank white space where I would like the picture to be.

       

      Any Ideas?

       

      -Andrew 

        • 1. Re: Using the 'Insert Picture' command in a script...
          philmodjunk
            

          You need the complete file path to the file not just it's name. Otherwise, filemaker can't figure out where to find the file.

           

          Try this to figure out file paths on your particular OS:

           

          Insert a picture by reference into a container field, let's call it "Picture".

          Define a calculation field to return text and enter the container field's name: Picture

           

          Place both fields side by side on your layout. Re-size the calculation field so that it can display 3 or more lines of text. Insert a picture by reference into Picture and see what appears in the calculation field--which will be the path to that picture's file in the format filemaker expects you to insert into the container field.

           

          PS. Insert text isn't generally the best script step for puting data in a field except for certain specialized uses. Set Field is a better option for doing this in your script.

          • 2. Re: Using the 'Insert Picture' command in a script...
            paintboothguy
              

            Phil, 

            I thought I'd replied to your post, but I didn't see it in the thread, so here it is again:

             

            I was able to use your trick to get a file path reported.....but.....

             

            --which will be the path to that picture's file in the format filemaker expects you to insert into the container field. 

             

            I'm not sure how or where to insert this path into the container field.

             

            Thanks,

            Andrew 

            • 3. Re: Using the 'Insert Picture' command in a script...
              philmodjunk
                

              You have to figure out an expression that works for your script. The details depend on what you are trying to do.

               

              The trick I mention, simply shows you what such a path would look like for your computer. You can use that as a guide in constructing an expression that works.

               

              Working from my own sample file where I first tested this, I insert a picture from one of my folders and see that the last section of the calculation field displays the path to my inserted picture:

               

              imagewin:/C:/Documents and Settings/Phil/My Documents/My Pictures/Farm Pict.jpg

               

              I can use that in my script to insert a reference to any file in the My Pictures directory if I know the file name and enter it in the filename field I defined:

               

              Set Field[MyTable::ContainerField; "imagewin:/C:/Documents and Settings/Jeff/My Documents/My Pictures/" & MyTable::filenameField]

              • 4. Re: Using the 'Insert Picture' command in a script...
                paintboothguy
                  

                Phil, 

                Good Morning!

                 

                Thanks for your response yesterday.  To be clear on my intent:

                 

                I wish to create a script that will populate (or 'place') a jpg (or pdf) of a certain drawing on a record in the Quotes layout.  So, if my client needs a quote for a Dust Devil, the quote (when emailed to him) needs to have this drawing visible, as well as some other information.   

                 

                Here is the script I created based on your instructions:

                 

                Set Field [Quotes::Booth Isometric; "filemac:/Macintosh HD/Users/andrewbaca/Desktop/" &  Quotes::Picture File Path 

                 

                The field above <Quotes::Booth Isometric> is a container field placed on the 'spot' where I'd like the photo to appear.

                The field above <Quotes::Picture File Path> is a calculation field where the path of the file was reported to me.

                 

                When I try to add a <]> at the end of the last field, like in your example, I get an error message "an operator (e.g. +,-,*,...) is expected here."

                 

                I should also report that the result of running this script places the icon of the image in the container field, not the image itself. 

                 

                What am I missing? (probably a lot!)

                 

                -Andrew 

                • 5. Re: Using the 'Insert Picture' command in a script...
                  philmodjunk
                    

                  Many new users get confused the first time they try to add Set Field to a script. See the following link for step by step instructions: (Scroll down towards the end of the thread.)

                  Selecting an "All" option with checkboxes

                  • 6. Re: Using the 'Insert Picture' command in a script...
                    bilderbach

                    Hey Phil,

                     

                    Did you ever find a fix for this?

                     

                    Robert

                    • 7. Re: Using the 'Insert Picture' command in a script...
                      philmodjunk

                      Fix?

                       

                      See the link I posted.