5 Replies Latest reply on Jul 9, 2010 3:17 PM by philmodjunk

    Get full name from "open file" script and write to record/field

    RedL

      Title

      Get full name from "open file" script and write to record/field

      Post

      We are planning a file management system.  Here is situation.

      1. We have a lot of files and located in different folders.  We need a file management system to manage it.

      2. We will categorize all the files and save the file location and file name to a table.  For example "FileSource" table record one:

      "SKU" field = "TA111"

      "Spec" Field = "C:\File\Spec\TA111Spec.pdf"

      "Diagram"field = "C:\File\Diagram\Verson123\TA111Diagram.pdf""

      Drawing" field = "C:\File\Drawing\Verson456\TA111Drawing.pdf"

      "Issue" field = "C:\File\Issue\\TA111.doc"

      3. We can enter the file full name manually, for example "C:\File\Spec\TA111Spec.pdf" to the "Spec" field of SKU "TA111" record.

      4. And we can use script to open each file, by using "open URL" with the full file name, under "Query" layout which is associated with FileSource Table.

      5. We would like to use "Open File" script user interface to locate the file and record the full file name ( directory with filename) to related record/field by script.

      Question:

      Q1: How can we get the full name from "open file" script?

      Q2: And how can we write to related field?


      Thanks.

        • 1. Re: Get full name from "open file" script and write to record/field
          philmodjunk

          Open File's only use is to open other filemaker files.

          Open URL will work as you've described. You can also insert these files in store by reference container fields which also stores the file's file path in a field you can double click to open the actual file.

          Other developers use a third party product called SuperContainer which you can look up with a web search if you are interested.

          • 2. Re: Get full name from "open file" script and write to record/field
            RedL

            Thank you for the swift reply.

            Yes, we use open URL to open other files.  Everything is fine now, except I need to enter the full data file name to the database manually.  It will be endless tasks and will have a lot of mistake.  That's why we need to have some user interface.

            "insert these files in store by reference container fields which also stores the file's file path" - Due to huge to data file size, we want to store the file path only.  We do not want to store the file inside the filemaker database.

            I am new for the file maker, if it is possible, please have a little more detail about your solution.  Thank you.

            • 3. Re: Get full name from "open file" script and write to record/field
              philmodjunk

              When you store files in a container using the "store by Reference" option I am describing, you do not store the actual file in the container--just the file path which is what you have requested here.

              Define a container field, given the multiple files you've described I'd define it in a related table for greater flexibility.

              Place this file on a layout, enter browse mode, click on the field and choose insert file from the Insert Menu and insert the file, being careful to click the store by reference checkbox. To open the file, just double click the field--no script required.

              • 4. Re: Get full name from "open file" script and write to record/field
                RedL

                Thank you so much.  I implement it and it works excellent.  New question - we will have thousand files.  We will use container to store all files.  Of course, "store by Reference only".  I would like to have a script which go through all of records and container fields automatically when necessary.  And check each file is exist or not - it means the container file is valid or not.  Because, we might rename or remove file some times and we might forget to change the container record.  How can I implement it?

                • 5. Re: Get full name from "open file" script and write to record/field
                  philmodjunk

                  I suggest investing in a file "plug in" that lets you list the contents of directories. You can extract the filename and file path from the container field and use that with the plug in to confirm that a file exists.

                  To see the filepath in your container field, define a calculation set to return text and enter the name of your container field as the sole term in this calculation field. Put it next to your container field on your layout and insert a few files. That'll show you what's really inserted when you insert a file. You can use text functions and functions such as GetValue to extract portions of this text from the container field in order to do this.

                  If you are using windows, the mooplug offers this capability and is free--just google that name and you'll find the download page and more info about it.

                  This is also where you might research supercontainer to see if it meets your needs as it offers some extended capabilities in this area.