Is your "big folder" inside your documents folder?
If so, with just FileMaker, you can set up a looping script and use Get ( DocumentsPathListing ) to insert a reference to each file into container fields in your database.
If it's not inside the Documents folder, you might use a plug in to get a listing of the folder contents.
Thanks for the response. The "big folder" contains all the microsoft word documents. So I think I do need to use the Get ( DocumentsPathListing ) function. Would I be able to set this up so that the path goes into a container field so I can open the document from a layout.
Sorry for the specific question, I'm new to FileMaker haha.
Think I misinterpreted your "big folder" question. It's a folder stored on my C drive.
In both the Mac and WIndows systems, there's a specific folder named documents. If your "big folder" is placed inside it, you can use the function I mentioned. If not, you have to use other means to get a list of the file names of the files inside the folder.
System scripts and batch files can be used and the text file that they produce imported into FileMaker, or there are third party produced plug ins that can list the contents of a given folder.
Once you have that list of file names, there are several strategies that can be used to build a table where you can get the functionality that you want.
I have attached a demo file that makes use of Goya's BaseElements plugin functions. You will need to select the correct version for your system and install the plugin first ( if I had bit more time I could have automated this for you but also wasn't sure if you wanted to use a plugin?). The following link should get you to the download/information page.
Once you have installed the plugin, the demo file gets you to select a folder that your files are located in and store the result in a global field.
You then click a second button that gets a list of all the files in the preselected folder which also stores the list in a second global field.
The script then goes to another table layout, deletes all the records (if any) and then loops through creating a new record for each file (value) that was previously listed in the global field. You can then click a button to automatically open the selected file from the list view off all the newly created records.
This is a cut down version of a solution I have that tracks records for individual clients and displays the result in a portal. An OnRecordLoad script trigger updates the portal. In this demo you will need to manually trigger the update the records from the original layout after you add/remove files from the nominated folder. It will work with all file types, not just MS Word.
File Import.fmp12.zip 68.5 K
What is the problem?
Listing files in a folder?
MBS Plugin has a function for this: Files.List
Also we have functions to read files like Files.ReadFile.
Or you use the Import File Script step in FileMaker directly.
If you like to extract text from those Word Documents or replace content, you can check our WordFile functions.
Sweet this helped a lot, I have it up and running now. Thanks!
It would be nice to update the portal/records every time a new file is added. Is the OnRecordLoad script another plugin?
On a Mac there is an option to create Folder Actions that could enable a change to the contents of the folder to trigger the script in FileMaker. Alternatively I have set up an InstallOnTimer script step to 'periodically' check the contents of the folder from within FileMaker.
I have attached a modified file. I have added some script steps to compare the current contents of the folder with the global field listing the last imported list of files. If they are the same then the script is exited without deleting and adding new records as it is not necessary.
I have then added an InstallOnTimer script that will check the contents of the folder every 5 seconds. If files are added or removed then new records are created. The script has been added as an "OnLayoutEnter" script Trigger ( added via Layout Setup/Script Triggers/OnLayoutEnter.) You can change the time interval in the "Check Folder" script. I only set it at such a short time interval for getting a quick response. In practice it probably could be a much longer interval?
I have also added an "OnLayoutExit" trigger to stop the InstallOnTimer script when you go to the other layout as there is no need to keep checking the folder contents at that point.
File Import2.fmp12.zip 69.1 K