raitis Posted September 13, 2012 Posted September 13, 2012 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
comment Posted September 13, 2012 Posted September 13, 2012 See if this helps: http://fmforums.com/forum/topic/45545-looping-script-to-extract-container-jpegs/page__st__-20#entry212714
raitis Posted September 13, 2012 Author Posted September 13, 2012 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
IdealData Posted September 13, 2012 Posted September 13, 2012 /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.
comment Posted September 13, 2012 Posted September 13, 2012 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"
raitis Posted September 14, 2012 Author Posted September 14, 2012 /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 :(
comment Posted September 14, 2012 Posted September 14, 2012 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
raitis Posted September 14, 2012 Author Posted September 14, 2012 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
comment Posted September 14, 2012 Posted September 14, 2012 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.
raitis Posted September 14, 2012 Author Posted September 14, 2012 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.
comment Posted September 14, 2012 Posted September 14, 2012 You will find that window in the Export Field Contents [] step, as part of the script.
raitis Posted September 14, 2012 Author Posted September 14, 2012 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
IdealData Posted September 14, 2012 Posted September 14, 2012 Your Docs folder will still need to be "Docs/" because Get (DesktopPath) already has a terminating "/"
raitis Posted September 14, 2012 Author Posted September 14, 2012 Your Docs folder will still need to be "Docs/" because Get (DesktopPath) already has a terminating "/" i already changed /Docs/ to Docs/
comment Posted September 14, 2012 Posted September 14, 2012 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?
raitis Posted September 14, 2012 Author Posted September 14, 2012 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 :)
Recommended Posts
This topic is 4800 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now