Re: Back Up FileMaker Pro Database with a Script
Re: Back Up FileMaker Pro Database with a Script
- Subject: Re: Back Up FileMaker Pro Database with a Script
- From: CYB <email@hidden>
- Date: Mon, 15 Dec 2008 22:14:02 -0600
- Thread-topic: Back Up FileMaker Pro Database with a Script
Title: Re: Back Up FileMaker Pro Database with a Script
Hi, I had an instance where several records in a FileMaker Pro database were deleted, and since FMP databases save without user interaction, the records were not recoverable. Is it possible to write a script that would automatically back up a FMP database, say once a day, perhaps by copying it to a particular folder? The backed up files would require different names so that they wouldn't overwrite each other; I could add a date stamp or sequential number to each file name. The real issue is making the backup file, since there is no "save as" command in FMP's scripting dictionary. A Finder script would work as well, the only thing I want to avoid is using FMP's internal scripting capabilities.
Thanks,
Garry Simon
Garry,
I do the same thing with some FM databases using the finder something like this”
[/SCRIPT]
--this properties will be saved with your script, no matter if you quit, until you open the script and recompile
property PathToMyDatabase : missing value
property PathToMyBackupFolder : missing value
-- I found that is better to copy files when these are not opened so try to quit FM
try
tell application "FileMaker Pro Advanced" to quit
end try
-- setting the actual date
set TodayDate to current date
set {DayDate, MonthDate, YearDate} to {day of TodayDate, (month of TodayDate) as number, year of TodayDate}
if DayDate < 10 then set DayDate to "0" & DayDate as text
if MonthDate < 10 then set MonthDate to "0" & MonthDate as text
--setting the paths for the first time
if PathToMyDatabase is missing value then set PathToMyDatabase to {choose file with prompt "Wher is your FM_DB"} as text
if PathToMyBackupFolder is missing value then set PathToMyBackupFolder to (choose folder with prompt "Please locate your backup folder")
--setting the name of your backuup file
set oldTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
set OriginalName to (text item -1) of PathToMyDatabase
set AppleScript's text item delimiters to oldTID
set BkUpName to OriginalName & "_" & YearDate & MonthDate & DayDate
-- now copy your FM_DB to your BkUp folder
tell application "Finder"
set NewBackup to duplicate PathToMyDatabase to PathToMyBackupFolder
set name of NewBackup to BkUpName
end tell
[/END OF SCRIPT]
Carlos Ysunza B.
Director
Ysunza/Santiago
Visual Communication • Automation
Tel. (52)55 5256-0336
email@hidden
http://www.ysunzasantiago.com
http://www.thesecretmexico.com
http://www.softrobot.com.mx
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden