Hate to bump a thread, but anyone have any suggestions?
Try using a calculation field or show custom dialog to expose the text being returned by GetAsText ( IMAGES::IMAGE1)
I recently discovered that if you drag and drop an image or use insert object instead of insert file or insert picture, you don't get the file name you expect here.
Well, the GetAsText has been working. If I hardcode the path in the Export Field Contents it works fine. I have the field _gSelectedFolder displayed on the form after the user selects a folder and it shows the complete path, eg: C:\**\folderchosen. I just can't for the life of me figure out why it's broken. Could it a formatting issue withe filewin or the way FM sees a path? I'm at my wits end as I need this option.
Taking a closer look at your script, shouldn't there be another slash in the path calculation that separates the last folder in $Path from the filename generated by the GetAsText function?
Set Variable [ $file; Value:"filewin:/" & $path & "/" & GetAsText ( IMAGES::IMAGE1) ]
That's consistent with the error message you report. I get that error message if I've munged up the file path somwheres.
You rock. I spent all night and two FM Bible's trying to figure that out. Works perfect.
Can I throw one more at you? I also configured the same export to take the student id from a record and export the image with that name, eg: A student has id 100100, that image is exported as 100100.jpg instead of it's original name, DCM100.jpg. The problem I'm having of course is that some student's have more than one image, so it exports the first image, renames it, then promptly overwrites it with the second image. I had thought of an IF/Else statement in the loop using the mooplug Fileexists to somehow check to see if there are two images or if one already exists, then add a _1 or _b to the end of the image somehow, like 100100.jpg, 100100_1.jpg. Any advice?
ps. I basically just changed the code within the loop to: GetAsText ( IMAGES::ID) & ".jpg"
The student images are stored in separate records in a container field?
I'd define an auto-entered serial number in that
fieldtable and include it in the file name. You might put together something like this:
100100_14563.jpg Where 100100 is the student ID number and the second value is the unique ID number of the specific image record. This requires zero looping and provides identifier numbers that won't change even if you add or delete image records
Images::ID & "_" & Images::ImageID & ".Jpg" would do the trick for you. (No need for GetAsText in this expression.)
Thanks, that works.