3 Replies Latest reply on Nov 8, 2010 4:52 AM by Belton

    Copying a file path to the Import Path List

    Mitch

      Title

      Copying a file path to the Import Path List

      Post

      Hi All,

      I have a Plugin (not sure of its origin) that enables me to select a file from my computer and the result is that file path and file name is copied to a filed within my database (Main_Page::File_Path), as text.  The result:

      /application/database/mydatabase.usr

      (Operating on a Mac) 

      I have tried using a import script with a variable:  Set Variable [$Path; Value: Main-Page::File_Path].  Then adding the variable $Path to the Import Path List within the script.

      However, when executing the import script the file can not be found.  Am I missing something?

      Mitch

        • 1. Re: Copying a file path to the Import Path List
          Belton

          The plugin sounds like Scriptmaster from 360works.

          It may be you don't have the full path. You also need the volume.

          /MyVolume/application/database/mydatabase.usr

          or you have missed out (relative path) file:$path or (fullpath) filemac:$path in the Import Path List

          (I found out about both these issues through trial and error at first! )

          The following works for me to get a fullpath

          Set Variable [ $filePath; Value:SelectFile ]
          Set Variable [ $Volume; Value:Get(SystemDrive) ]
          Set Variable [ $fullPath; Value:Left ( $Volume ; Length ( $Volume ) -1 ) & $filePath ]
          If [ $filePath= 0 ]  //User cancelled
            Exit Script [  ]
          End If

          • 2. Re: Copying a file path to the Import Path List
            Mitch

            I am not sure where the plugin came from, but I do also have the 360 Works plugin.

            Your solution works well and of course looks like it will be suited to both Windows and Mac runtimes.

            Thanks....

            Mitch 

            • 3. Re: Copying a file path to the Import Path List
              Belton

              A follow up. (after bug testing a solution for Windows) 

              The volume only needs to be appended to the Mac filepath returned by Scriptmaster to make a full path.

              On Windows Scriptmaster already returns a full path. BUT it returns it in windows format

              C:\folder\file

              this will need to be converted to C:/folder/file for filemaker to use it.

              Set Variable [ $FMfilePath; Value:Substitute ( $filePath ; Char ( 92 ); Char ( 47 ))]

               "\" causes problems in the formula hence  Char ( 92 )

              If you use Scriptmaster to run other functions requiring a filepath, it should stay in Windows format