September 13, 201213 yr dear fmforum, my database has many products and each has its unique product ID. each item has 1 to 6 images. i added a "button setup" to the image in the layout. it triggers a "export field content". it exports the image to my desktop with the filename 1,2 ... till 6.jpg is it possible to export the image with the product ID as a filename? e.g. 232345.jpg, 232345-2.jpg ... till 232345-6.jpg sincerely, raitis
September 13, 201213 yr See if this helps: http://fmforums.com/forum/topic/45545-looping-script-to-extract-container-jpegs/page__st__-20#entry212714
September 13, 201213 yr Author i tried to add this to the "specify output file": Show All Records Go to Record/Request/Page [ First ] Loop Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & Products::Product ID & ".jpg" ] Export Field Contents [ Table::ImageField; “$filePath” ] Go to Record/Request/Page [ Next; Exit after last ] End Loop i get this error: please correct the syntax of this line: Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & Products::Product ID & ".jpg" ] can you help me? what is wrong? sincerely, raitis
September 13, 201213 yr /docs/ could be the problem. Not sure if you need the first / Does docs folder exist on the desktop? Use a dialog box to show $filepath, that should reveal all.
September 13, 201213 yr i get this error: please correct the syntax of this line: Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & Products::Product ID & ".jpg" ] I have never seen such error message. Can you post a screenshot of it? Anyway, I believe that since you are running under Windows, $filePath should be set to = "filewin:" & Get ( DesktopPath ) & "Docs/" & Products::Product ID & ".jpg"
September 14, 201213 yr Author /docs/ could be the problem. Not sure if you need the first / Does docs folder exist on the desktop? Use a dialog box to show $filepath, that should reveal all. i removed the first / nothing changes. I have never seen such error message. Can you post a screenshot of it? Anyway, I believe that since you are running under Windows, $filePath should be set to = "filewin:" & Get ( DesktopPath ) & "Docs/" & Products::Product ID & ".jpg" screenshot attached. i am using MAC not win. still not working :(
September 14, 201213 yr Could you move that error window a bit and show us what you have in the Output File Path List? It looks like you have typed the entire script there? If so, please see: http://www.filemaker.com/11help/html/create_script.12.3.html#1037007
September 14, 201213 yr Author Could you move that error window a bit and show us what you have in the Output File Path List? It looks like you have typed the entire script there? If so, please see: http://www.filemaker....3.html#1037007
September 14, 201213 yr That's not going to work. All that should have been there is: $filePath Of course, you cannot use the $filePath variable without defining it first; that's why you need a script, with several script steps, instead of a attaching the button to a single action.
September 14, 201213 yr Author That's not going to work. All that should have been there is: $filePath Of course, you cannot use the $filePath variable without defining it first; that's why you need a script, with several script steps, instead of a attaching the button to a single action. thank you! thats what i thought. i will try to make a new script with this: Show All Records Go to Record/Request/Page [ First ] Loop Set Variable [ $filePath; Value:"filemac:" & Get ( DesktopPath ) & "/Docs/" & Products::Product ID & ".jpg" ] Export Field Contents [ Table::ImageField; “$filePath” ] Go to Record/Request/Page [ Next; Exit after last ] End Loop and then i will add $filePath in the window i send you.
September 14, 201213 yr You will find that window in the Export Field Contents [] step, as part of the script.
September 14, 201213 yr Author You will find that window in the Export Field Contents [] step, as part of the script. thank again. i made a script and now it works! one problem: i have 6 images for each product. each time it exports the image it overwrites the old one. is it possible that they are not overwritten, but in this way e.g. 232345.jpg, 232345-2.jpg ... till 232345-6.jpg
September 14, 201213 yr Your Docs folder will still need to be "Docs/" because Get (DesktopPath) already has a terminating "/"
September 14, 201213 yr Author Your Docs folder will still need to be "Docs/" because Get (DesktopPath) already has a terminating "/" i already changed /Docs/ to Docs/
September 14, 201213 yr Your Docs folder will still need to be "Docs/" because Get (DesktopPath) already has a terminating "/" It's good practice, but it will work either way. i have 6 images for each product. Where are those 6 images kept? Do you have a related table of Images?
September 14, 201213 yr Author i managed it. this is what i added: $filePath: Value: filemac: & Get ( DesktopPath ) & "Docs/" & Products::Product ID & "_1.jpg" $filePath: Value: filemac: & Get ( DesktopPath ) & "Docs/" & Products::Product ID & "_2.jpg" etc. thanks everybody :)
Create an account or sign in to comment