If you select Export Records from the File Menu, can you export records via that method?
A manual export performs many of the same tasks as your script, so being able to export manually (or not) may provide a clue as to why you are having trouble.
Sharing a copy of your script--you can post a screen shot of it, might also be helpful.
Yes your screen shot was uploaded, though in my experience .png files work better for uploading screen shots here.
If you have FileMaker Advanced, I suggest running this script with the debugger enabled so that you can step through it step by step and see where any errors might be occurring.
Also, when you manually exported, to where did you export? I don't see any info in the script that would specify a specific directory to which to export these records. It's possible that you are selecting a location where your computer account grants "write" permission for creating the exported text file, but that your export records script step is trying to "write" to a folder where you do not have permission to create such a folder.
If you don't have advanced, how do you know that it:
works fine up to the two Export Records step.
Next thing that I'd check is to confirm that the scripted find is actually finding records.
Then confirm that the layout's table occurrence is correct for both the find and the export. (A table occurrence is a "box" in the relationships graph. This is selected in Show Records from in Layout setup and also in the source table drop down in your export records dialog.
I know that is works up to that point because all it does is ask me for what to search for, then, upon entering that and doing the find, I can see in the layout window that it does the find correctly. The next two steps are the two Export Records steps, both of which produce an error message.
This script worked fine for years when I had the FileMaker program, the database file, and the export files all residing on our Time Capsule so that different people on other computers could access the database (but not at the same time). But when it came to be that I was the only one using the database, I transferred everything to my computer. It works much faster on my computer then when it was on Time Capsule. After having done this, the only thing I have found that doesn't work the same is this Export Records step. It's very simple, should work, but it doesn't.
I checked the things you said and everything is correct. The table that it is finding records in and exporting is not related to any other table in the database. The script should export the found records to the text files, then, later in the script, import those records into the main database.
Thanks for your help.
I suggest that you try
a) Recovering the file
b) If recover doesn't fix the issue, create a completely new script for exporting records (you can keep the script very simple for testing and then expand it if it works for yo.
I suggest this because your use of TimeCapsule for this could have damaged your file and this damage may only have affected the behavior of your file just recently.
The only time I've ever run into that error message is when OSX permissions are not properly set up. For exporting via a script you need to make sure fmserver and fmsadmin and fmuser (something like that anyhow) have read & write access to the folder you are using. Sometimes these permissions can get corrupted if you copy and paste folders; if that is the case you can get round it by creating new folders and transferring the contents rather than the folders themselves. You should be able to test this possibility by changing your export filepath to use Get ( TemporaryPath ) which will use a location FM itself creates on the fly. If that still fails, then something else is causing your problem.
You are missing volumeName in the path.
To export to the documents folder you should be using get( documentspath ) function.
Script this by setting a variable (say $path) to the document folder and the file name, the specify the variable ibt the export step dialog.
Set Variable [ $path ; Get( DocumentsPath ) & "whatever.pdf"
Note these is no need to prepend "file:" to the path (in later versions, not sure about 12 -- you should upgrade).
As others have said, OSX limits where applications can save files.
OK, I recovered the file. Nothing found wrong in the report. Script still did not work.
Did as you said, made a new script with just the Export Records step. After selecting the records manually, the new script worked.
Went back to the original script and took out the Export Records steps and saved. Then I replaced them, saved and they worked. Then later in the script the Import Records steps gave me error messages, but for them all I had to do is go in and re-designate the target files. It all works.
Thank you for being so patient and for your excellent suggestions.
I had changed permissions to Read and Write for everything in the path.
The issue has been resolved by deleting the erring steps, saving, then adding them back in "fresh".
Thanks for your help.
No, doesn't need that (at least in this version). Besides that path was put there by the selection of the file through the "Add File..." dialog box.
Thanks for your help.
Thanks for your suggestions. I am not sure FM 12 uses variables in scripting. When I wrote these scripts I could have used them and searched in the help docs but found nothing on them, so I assumed they couldn't be used and scripted around the need for them. Anyway, your suggestions are food for thought and I will consider them.
If FM 12 does allow variables in scripts, please correct me.
My scripts are now working. I deleted the erring steps, saved, then added them back in.