You may have a couple of problems;
- If you manually specify a file name in the 'Specify Output..' box of 'Save a Copy' you'll see that it is prefixed with a 'file:..' syntax. I think I would repeat that.
- When you set that saved file to open, and then the next script step is 'Close Current File', does it not close the file it has just opened? Do you not have to take the focus back? (Can't remember, hence my question.)
- You have specified the variable as $Variable, so that's the one to use. I don't see any need to specifiy it as a $$Variable. I expect it's a typo, but you have a quotation mark after the Save a Copy as [$filepath"...
But I am ever surprised at the number of people who post that they have problems taking repeated copies of files, saving in the correct location, renaming them with dates, years, players' names, etc. In 20 years I have only ever (I think) saved regular copies as backups. If you are trying to catagorise sets of records by season year and session, why not log that in the record and keep them all in the same file? If people are sending you files, why not import the records? If you want to exclude viewers from certain records why not set that in the privileges? I'm starting to feel that some bit feature - or exposure - of FM has passed me by. If you want it as a form of regular backup Phil has posted a 'Developer's Friend' back up script that would work well here - just change the trigger from being time-based.
Sorbsbuster... Thank you for your timely reply. Oops! The extra quote mark of Save a Copy as [$filepath is my mistake - it's not in my actual script. I'll try repeating the 'file' prefix - that's a good suggestion. Also I could put ALL records in the same file separated by each season of the year and have the user log into a specific season... an excellent idea!
Yes, the original (modified) file stays in focus even after the newly named file is automatically opened. So, in my case, Close File does close the original (modified) file, giving the newly named file the focus as expected. If the focus were the other way around I would think my next script step to Open (the New) File would never get executed.
To clarify my purpose in all this file opening and closing... The complete script saves a copy of the current (unmodified) file
• then Finds and deletes all records that are out of date
• then saves the modified file using a new pre-defined file name
• then opens the newly defined file (not on focus)
• then closes the current (modified) file under the original file name
• leaving the new modified file (with the new name) on focus.
This gives me a copy of the original file (unmodified), a modified file under the original file name (discarded manually), and finally a modified file under the new file name.