Don't see how you would use a loop script to check for changes to the contents of a folder unless you used a plug in or the folder was located inside your documents folder.
But instead of a loop. Take a look at Install OnTimer Script. You can use it to set a script to run at regular intervals to check that folder--provided that you have a method to get a list of that folder's contents.
would that not bring up the egg timer to say a script is in process because i would pretty much need it to import every second and update the database to be sure it caught every order that comes through
i did its brings up an egg timer as the cursor with a little esc next to it and it freezes up filemaker :) attached is what the 2 scripts look like :)
You are still using the loop. Install OnTimer Script should take the place of the loop.
Your loop also lacks an exit step--either exit loop if or go to record with the "exit after last" option specified. Thus, you are trapped in an infinite loop that never ends.
And I don't see anything in the script that "checks to see if the folder contents have changed".
I have been assuming that by "folder" you are checking the list of files located in a specific folder on your computer's hard drive. If you meant something else, please explain. If you do mean an OS folder, please explain how your script checks for those changes.
i dont have a script to check for changes sadly thats sorta kinda what i was asking but not fully i need a way of importing 2 files constantly into filemaker as those files are constantly being updated i need filemaker to be constantly updated what is the best route to do this? is there a watch folder script? how do i accomplish this?
There is no "watch folder" script. If the file names of the files remain the same, but the contents keep changing as new copies are saved to the folder, you might look into setting up a recurring import for those two files. This is an option that generates the needed script for you and is supposed to result in the data in the file being imported each time the file changes. The catch here, is that the script purges the FileMaker target table each time (deletes all records) if I remember correctly, and that may not work for you.
But look this option up. Not only might I not be remembering or the purge might not be an issue, there may be a way to modify the script thus produced so that it will work as needed.
If you want to use Install OnTimer Script instead, do it by this general out line
Import records (no loop! Just do the steps to import your data a single time here.)
Install OnTimer Script (Specify the name of script 1 and the interval in seconds between imports.)
You then run script 2 once and then Script 1 is performed automatically every X seconds (as specified by you) with normal control of the databae in between script runs. This will continue until the window that was oepn when script 2 was performed is closed or until another Install OnTimer Script step is performed in a script. (This would set up a new timer on the current window or, if no parameters are specified, simply cancel the current timer.)
ok so recurring import does purge all records everytime time so that isnt really an option the script can be edited but it also breaks every other script i have where it needs to show all etc so it ruins my find scripts and install on timer works fine but also breaks my finds im linking to my dropbox with the file if you could take a look and tell me whats going wrong :)https://www.dropbox.com/s/euazya7luvmi0fp/bannerwarehouse%20system.fp7
thats the file and https://www.dropbox.com/s/2f2yactxqvk7j97/1.csv thats file 1
https://www.dropbox.com/s/qwk020zmgv9svh0/2.csv thats file 2
ohhhh logins admin with no password
but it also breaks every other script i have where it needs to show all
That shouldn't happen with either script. Show All records is a single script step that you can insert into any script to show all records so this really shouldn't be the case.
Sorry, but I don't have time to download and examine a file at this time...
You could, however, post the script(s) involved.
To post a script to the forum:
- You can upload a screen shot of your script by using the Upload an Image controls located just below Post A Answer.
- You can print a script to a PDF, open the PDF and then select and copy the script as text from the opened PDF to your clipboard for pasting here. (with this approach, you can get multiple script steps on the same line, please edit the pasted text by inserting some returns to separate those steps.)
- If You have FileMaker Advanced, you can generate a database design report and copy the script as text from there.
- If you paste a text form of the script, you can use the Script Pretty box in the Known Bugs List database to paste a version that is single spaced and indented for a more professional and easier to read format.
ok so basicly here are my 2 scripts pretty basic :) the screen showing behind is one of found items and i lose the found records every second
i search i enter the number and search for it press return to search and the it then shows the 1 found record but then dissapears quickly because the import is doing something i need to be able to view the found records without them dissapearing
i need to be able to view the found records without them disappearing
There are two basic solutions to that issue:
1) Have the import script open a new window. The finds performed in that window will not affect the found set in your current window.
2) Go to Manage | Database | Relationships and duplicate this layout's Tutorial: What are Table Occurrences?. (Button wihth 2 plus signs) Create a new layout and base it on this new table occurrence by selecting it in the "show records from" dialog. Have your import script change to this layout for finding and importing records. (update the script so that it references this new table occurrence.
Each table occurrence has it's own found set, current record, sort order so the operations that change this on the new layout will not affect the found set that you have on your current layout.
Ah smashing there was me starting to lose all hope :) cheers one last question seeing as your answering all my questions I need to insert a couple of images but the images are always being created I need to apply a script or something to insert an image into a layout the folder where the images are located will never change and the filenames for the images are referenced within each record so I ill need a new image every time I have a new record basicly we have about 50 ordered a day at the minute and I want filmmaker to build the job sheets for it So one order may have 1 design and I need the job sheet to show place for only one job sheet but if it has 2 images and 2 design names obviously ill need to show both and so on thanks in advance :)
Images can be inserted or imported into container fields. Insert Picture can insert either a copy or a reference to the image file. Import Records | Folder can do the same and import the file name into a text field at the same and it imports all files in the specified folder.
And there are ways to use a computed FilePath to insert that image file into a container field via a script if your script can get the exact name of the file to be inserted. This uses a $Path variable where the script calculates the filepath (which includes the name of the file) to be used in that variable.
If that looks like an option you need to try, see this thread on $Path variables, container fields and the scripts that can work with them: Exploring the use of a $Path Variable in Scripts