August 31, 201114 yr G'Day FM Gurus, I am using FM Pro 11 in a Windows XP pc and trying to export several images from a database to a folder in my PC by following the documentation below: http://help.filemaker.com/app/answers/detail/a_id/5822/related/1 I tried initially running the following script Loop Set Variable [$filePath; Value: "filewin:" & Get ( DesktopPath ) & JECMCollection adam::Item ID & ".jpg"] Export Field Contents [JECMCollection::Photo; “$filePath”] Go to Record/Request/Page [Next; Exit after last] End Loop but it gives an error for each record that can not write in the disk. This is my first experience scripting with File Maker pro so I do not know what is missing in the script above to work properly as indicated in the documentation link I appreciate any help Kind regards Carlos
September 1, 201114 yr Author You might not need to prepend "filewin:" to the path. Hi Vaughan If I take "filewin" off like this Loop Set Variable [$filePath; Value: Get ( DesktopPath ) & JECMCollection adam::Item ID & ".jpg"] Export Field Contents [JECMCollection::Photo; “$filePath”] Go to Record/Request/Page [Next; Exit after last] End Loop Then I get container can not be exported This script works for one record Go to layout ["two picture"(JECMollection adam)] Export Field Contents [JECMCollection adam::Photo] IfI loop it then it will ask me for each record. I would like to avoid that I appreciate any suggestion Cheers
September 1, 201114 yr Does the file already exist on the desktop? Look very carefully. You must include "filewin:" at the beginning of the path.
September 1, 201114 yr It could be the same issue as here: http://fmforums.com/forum/topic/45545-looping-script-to-extract-container-jpegs/page__p__212911#entry212911
September 1, 201114 yr Check that the name of the jpeg file does not have any illegal characters in it.
September 1, 201114 yr Some one got caught with the illegal character last week. They had used ":" in the filename, it's illegal on both Windows and Mac - but it is the ONLY illegal character on Mac. One that gets many is the TRAILING SPACE, especially as the filename is being built from data in a field.
September 2, 201114 yr Author It could be the same issue as here: http://fmforums.com/...911#entry212911 It is the same problem Consultant but I am using FM 11 in a PC Does the file already exist on the desktop? Look very carefully. You must include "filewin:" at the beginning of the path. I have the same problem by using "filewin:" or without it and suggested by Vaughan and get the following error:
September 2, 201114 yr Author This where I am at the moment; I am using the following script to extract container JPEGs Show all the records Go to Record/request/Page[First] Loop Set Variable [$filePath; Value: "filewin:" & Get ( DesktopPath ) & JECMCollection adam::Item ID & ".jpg"] Export Field Contents [JECMCollection::Photo; “$filePath”] Go to Record/Request/Page [Next; Exit after last] End Loop Where JECMCollection adam::Item ID is a collumn in teh database with the ID of the photo and JECMCollection::Photo is where the photo is located in the record I also tried it without "filewin" and I get the following error for each record: I appreciate any one who can help me to get this script right The following script works but by one Go to layout ["two picture"(JECMollection adam)] Export Field Contents [JECMCollection adam::Photo] For the ones who has tried to help me please have patience with me as this is my first script Kind regards Carlos
September 2, 201114 yr Author Doesn't matter. Tried to copy the script from : http://fmforums.com/forum/topic/45545-looping-script-to-extract-container-jpegs/page__p__212911#entry212911 to my situation Show all the records Go to Record/request/Page[First] Loop Set Variable [$filePath; Value: "filewin:" & Get ( DesktopPath ) & "/Docs/" & JECMCollection adam::Item ID & ".jpg"] Export Field Contents [JECMCollection::Photo; “$filePath”] Go to Record/Request/Page [Next; Exit after last] End Loop and still got the same error So I still do not know what to do to get it right Carlos
September 2, 201114 yr I dunno... the dialog saying "Container fields cannot be exported" suggests he's not using Export Field Contents. But I'm happy to take your money... :D
September 2, 201114 yr Author Why don't you post your file. Hi Consultant What file are you referring to? Cheers Carlos Use the Export Field Contents script step, not the Export command, Hi vaughan I am using the script step options to configure Export Field Contents Kind regards Carlos I'll give 3:1 odds that it's the space in the file name. Hi David Which space are you referring to? Kind regards Carlos Dear all, Thanks for your time and suggestion so far and hope that you stick with this newbie and get this script working It is Friday 5PM in Australia and I am heading for the weekend but I will check this again in two days time Cheers Carlos
September 2, 201114 yr This is where the problem is: Set Variable [$filePath; Value: "filewin:" & Get ( DesktopPath ) & "/Docs/" & JECMCollection adam::Item ID & ".jpg"] Any one spot it? "/Docs/" should be "Docs/" because Get (DesktopPath) yields "/DesktopPath/" and that would mean there are 2 slashes together, which of course is an illegal path specification. NB. - "/Docs/" was not in the original post. JECMCollection adam::Item ID could still be yielding an invalid character, you need to check what is the content of that field.
September 2, 201114 yr there are 2 slashes together, which of course is an illegal path specification. Is it?
September 2, 201114 yr Set Variable [$filePath; Value: "filewin:" & Get ( DesktopPath ) & JECMCollection adam::Item ID & ".jpg"] Export Field Contents [JECMCollection::Photo; “$filePath”] I see two contexts.
September 2, 201114 yr Hi David Which space are you referring to? The one in the filename "RC 25.jpg". But I may have to eat my words. It could be the double slash or the wrong context. Or something else entirely.
September 2, 201114 yr I noticed the 2 contexts aswell, but that shouldn't matter, what will matter is what Set Variable [$filePath; Value: "filewin:" & Get ( DesktopPath ) & JECMCollection adam::Item ID & ".jpg"] actually evaluates to.
September 5, 201114 yr Author This is where the problem is: Set Variable [$filePath; Value: "filewin:" & Get ( DesktopPath ) & "/Docs/" & JECMCollection adam::Item ID & ".jpg"] Any one spot it? "/Docs/" should be "Docs/" because Get (DesktopPath) yields "/DesktopPath/" and that would mean there are 2 slashes together, which of course is an illegal path specification. NB. - "/Docs/" was not in the original post. JECMCollection adam::Item ID could still be yielding an invalid character, you need to check what is the content of that field. I tried by including "Docs/" in the Set variable and still got "Container Fields can not be exported" I wonder if it is the fact that only few records have photos most are empty. I can export one photo by right clicking in the form view or by locating in the record and using the following script: Go to layout ["two picture"(JECMollection adam)] Export Field Contents [JECMCollection adam::Photo]
September 5, 201114 yr Author The one that contains the problematic script. Are you referring to post the FM database? or only a file with the script? I can see that I can import an script into it but I have not figured out how to export the problematic script. Cheers
September 5, 201114 yr I'm going to be unbelievably anal and ask that you check that the SCRIPT is actually using the Export Field Contents step, and not the ordinary Export step. Post a screen shot of the script steps to confirm.
September 5, 201114 yr Author I'm going to be unbelievably anal and ask that you check that the SCRIPT is actually using the Export Field Contents step, and not the ordinary Export step. Post a screen shot of the script steps to confirm. Hi vaughan, This is screenshot s requested
September 5, 201114 yr I wonder if it is the fact that only few records have photos most are empty. Aaagghhhhhh!!!! Yes, that is the problem. Adjust your script to check for empty containers before exporting.
September 5, 201114 yr It's getting hard to remember, but the original error message was about the path. You will get the "Container fields can not be exported" message when a container field is empty - but this has nothing to do with the original problem.
September 5, 201114 yr Which comes first in the error procedure - the PATH error or the EMPTY CONTAINER error. Logic suggests the empty container is tested first and so the path error is not disclosed. Having re-read the original post it looks like there was nothing wrong with the path in the first instance.
September 5, 201114 yr Which comes first in the error procedure - the PATH error or the EMPTY CONTAINER error. Logic suggests the empty container is tested first and so the path error is not disclosed. That's a good question. Why don't you try and see if Filemaker follows your logic. Having re-read the original post it looks like there was nothing wrong with the path in the first instance. Now that's a logic that I don't follow. If there was nothing wrong with the path, why was there a path error message?
September 5, 201114 yr It seems that the early posting of a sample file would have solved this much sooner.
September 6, 201114 yr Author Thanks Guys for all your help. Here is a script that works: Cheers Carlos
September 6, 201114 yr The first post's example script does not match the screenshot in the last post. The context issue is resolved and the path includes "Docs/" Screen shots, empty containers and sample files--you think we'd learn by now!
Create an account or sign in to comment