2 Replies Latest reply on Jul 31, 2010 6:00 PM by Tristis

    Can I use a script to save a file using its date as its filename?



      Can I use a script to save a file using its date as its filename?


      I used to be a Program Director for a Canadian community access radio station. Don't let the word "program" fool you: I was all about radio shows, not computer software. But I made do. 

      I am back volunteering where I used to work, trying to help my station slide into the twenty first century. Radio stations require a log of all broadcast activities. In the past, we used paper logs. We started with Filemaker way way back in 1992 and our Program Director (me, 6 months into this) was the only one to manipulate data by creating records of each scheduled task in a list that constituted a day's worth, then printed that list and put it on a clipboard so the fifteen or so daily announcers could fill out the log as printed.

      The last version we used was Pro 6. And our last method of doing so was to have a week's worth of records (we use one field for the scheduled time, another for the title of the task, another for the legal category etc.), sorted by day of the week (we included no dates, because the week's file was a template), which I imported to "day" files, which were then printed.

      Now the station has bought Filemaker Pro 11 advanced. I want to have paperless logs using a Mac mini in the control room to run a file created in the PD office (using that "run" feature that lets us do this without installing filemaker in the studio).

      What I have from the old system is that week's worth of partially filled-in records. I'd like to keep this simple, and keep it looking pretty much the same (to lessen how many announcers I have to re-train and by how much) but I also need to have what is now to be digital information instead of paper kept secure for government/legal purposes. The log has to be kept for minimum of a year.

      The vision I have right now is that, on Monday, an announcer would open a file called "Program Log," hit one button and it would import all the records—without dialogue—from my raw week's data file. The announcer would enter the times s/he did things in the blank fields of the records and then, automatically at the end of sunday night's broadcast, when the last entry is made and the file closed it would save as the date.

      I'm okay with the script for importing and for "saving as the date" being a button, rather than the file's preferences on open/close, but at this point, it doesn't matter because I don't quite know how to make a script save as a current date. 

      Truth be told, I haven't checked out the import idea yet, either. This date thing seemed like the more basic need. Without it, the file could be over-written week after week and we would lose the past constantly. I need a secure and darned near foolproof archiving mechanism.

      I've made scripts before, but they were all pretty basic find/sort things. I start to flounder when I encounter jargon like "$variable" and "paths" that come up in the dialogue boxes.

      Can anyone help with this?

        • 1. Re: Can I use a script to save a file using its date as its filename?

          I don't see why you need to import any data. I'd have your announcer simply use a layout designed for the purpose update the records you've already created for the week. I also wouldn't save weekly copies of the data. I'd keep all the records in one frequently backed up file. You can then use finds to pull up specific groups of records by date to see the log for a given week.

          Be that as it may, you can use a script to save copies of a file that includes the date--that's one way to automate a back up process if you aren't using filemaker server. Here's the script I've used:

          Set Variable [ $Path ; Value: Let ( today = Get ( CurrentDate ) ; "filewin://Foldername/Filename " & Year(today) & "-" & Right("00" & Month ( today ) ; 2 ) & "-" & Right("00" & Day ( Today ) ; 2 ) ) & ".FP7"
          Save a copy as [$Path ; Copy ]

          The expression replaces / with - in order to use characters that are permitted in a filename.

          • 2. Re: Can I use a script to save a file using its date as its filename?

            Thanks so much for the prompt reply. I hadn't expected one so soon.

            I will give the script a try. I'm trying to understand it as I go and it almost makes sense to me. 

            While I would like to have a layout that the announcers just filled out, it would need to change nearly as often as their entries, so I cant' see any way to do that without using changeable records. I will think about it some more, though.

            Thanks again.