Scripting FAX data to FM database

I have the need to have a proper log file for PageSender, and I figured out what I need (file name, time&date, station ID) and I can display the info (of course in one window without separating them), but I’d need to create a tab-separated file and save the info about the received faxes once a day in it, so I can import it into FileMaker.

My problem is that I don’t even know what commands I’d need to place in the script. Any help is apreciated…like what search terms I should search for on this BBS. :slight_smile:


Assuming you have the required data in variables called ‘file_name’, ‘fax_date’ and ‘station_ID’, this should do the trick:

set logFile to open for access file "path:to:logfile.txt" with write permission
write (file_name & tab & fax_date & tab & station_ID & return) as string to logFile starting at eof
close access logFile

So, this is the script I made and I’m getting an error:

“File some object wasn’t open.”

set logFile to open for access file "Macintosh HD:Users:fax:Library:Page Sender:Logs:IncomingLog.txt" with write permission
tell application "Page Sender Fax Center"
	repeat with aFax in (faxes of folder "In")
		write (fax name of aFax & tab & date of aFax & tab & base filename of aFax & return) as string to logFile starting at eof
		close access logFile
	end repeat
end tell

What am I doing wrong?

Also, can I make this automated at a certain time every morning, right? Or only at login?


What you’re doing wrong is closing the file after the first write. You need to move the close file so that it’s outside the repeat loop so that you don’t close the flie until all entries have been written.

As for automating it, there are several techniques for scheduling scripts. cron is one (administered through the command line), or iDo’s Script Scheduler ( )