2 Replies Latest reply on Jan 7, 2014 9:01 PM by NicholasFernandez

    $filePath Variable Losing Its Way

    NicholasFernandez

      Title

      $filePath Variable Losing Its Way

      Post

           Hi all,

           The script I'm attaching below is intended to export and import a picture stored in a container field for each record, and in the process rename the externally stored file based on the current record's fields.

           The export part of the script is working perfectly fine. The file is created exactly where I expect it to be, and it is properly named. However, FileMaker claims to be unable to locate the file when it comes time to reimport it into the container field. I'm particularly confused since I'm using a variable, and thus the path should be identical.

            Any help is appreciated. I may be over complicating the matter. Also, the script looks pretty busy with all my substitutions, but that is just to avoid invalid filenames. Thanks in advance!

            

             
      •           Perform AppleScript [ Native AppleScript: set folderName to "RF Images" set folderLocation to path to desktop tell application "Finder" if (exists folder "RF Images" of folderLocation) = false then make new folder with properties {name:folderName, location:folderLocation} end if end tell ]
      •      
      •           Show All Records
      •      
      •           Go to Record/Request/Page [ First ]
      •      
      •           Loop
      •      
      •           Set Variable [ $filePath; Value:Get ( DesktopPath ) & "/RF Images/" & Substitute ( ${* Start-Up DB}::Image# ; ["/" ; "-"]; ["?" ; "-"]; [";" ; " -"]; [":" ; " -"]; ["<" ; "-"]; [">" ; "-"]; ["|" ; "-"]; ["\\" ; "-"]; ["\"" ; ""]; ["*" ; "-"] ) & " " & Trim(LeftWords( Substitute ( ${* Start-Up DB}::Author Title Edition ISBN ; ["/" ; "-"]; ["?" ; "-"]; [";" ; " -"]; [":" ; " -"]; ["<" ; "-"]; [">" ; "-"]; ["|" ; "-"]; ["\\" ; "-"]; ["\"" ; ""]; ["*" ; "-"]; ["¶"; " "]; [Char(13); " "]; [Char(10); " "] ); 5)) ]
      •      
      •           Export Field Contents [ * Start-Up DB::Images; “$filePath” ]
      •      
      •           Go to Field [ * Start-Up DB::Images ]
      •      
      •           Insert Picture [ “$filePath” ] [ Reference ]
      •      
      •           Go to Record/Request/Page [ Next; Exit after last ]
      •      
      •           End Loop