AnsweredAssumed Answered

Using a script to import jpg images to container field

Question asked by autumnsky on Mar 5, 2012
Latest reply on Mar 5, 2012 by philmodjunk


Using a script to import jpg images to container field


I'm a little stuck.

I have a script that exports jpg images out of a container field. The script creates a directory on the desktop called "Export_Images" and then loops through the records exporting a container field and naming each exported file: RecordID &".jpg"  

Once completed, the Export_Images directory contains series of files that look like this:





I now want to import these images back into a clone of the database (BTW, I first import all the data fields into the clone database. So records with the correct RecordID are all created once I start the image import script.) Here is my routine for importing the jpg images back into the container field for each record:

     Go to Layout[TargetLayout]

     Go to Record/Request/Page [First]


     Set Variable [$filepath; Value "filemac:" &  Get ( DesktopPath ) & "Export_Images/" & RecordID  & ".jpg""]

     Go to Field [z_TargetContainer]

     Insert Picture ["$filepath"]

     Go to Record/Request/Page [Next; Exit after last]

  End Loop

  Exit Script[]


When I dump the variable $filepath into a field, the path and filename seems correct:

   filemac:/Macintosh HD/Users/UserAccountName/Desktop/Export_Images/10000.jpg

but when executing the script,  I receive an error message: The file "10000.jpg" could not be found and is required to complete this operation.  What am I doing wrong? Sorry if this post seems confusing and thanks for your time and help.