This script was adapted from one written specifically for a FileMaker Pro program, although it could easily be used in any database program you use that supports AppleScript.
Most of what appears here builds upon the information presented in previous posts to this point. For a similar AppleScript that is tailored specifically for use with HyperTalk, see ‘HyperCard AppleScript Users’ in the right sidebar
tell application "Finder"
try
set todaysDate to (current date)
set bkpYear to (year of todaysDate)
set monthlyBkp to ("Monthly Reports " & bkpYear) as text
if not (folder "Database Backups" exists) then
set targetFolder to (make new folder at folder "Desktop" of startup disk with properties {name:"Database Backups"})
end if
set replaceExecute to button returned of (display dialog "Are you sure you want to replace current backup contents with the selected items?" with icon caution buttons {"Cancel","OK"} default button {"OK"} giving up after 60) –give user the chance to exit in case there is already a folder ‘Database Backups’ containing items that the user does not want to replace if replaceExecute = "OK" then
select {file "Home Database" of folder "Database Programs)", ¬
file "Appointments" of folder "Database Programs", ¬
file monthlyBkp of folder "Database Programs", ¬
file "Accounts Receivable" of folder "Database Programs", ¬
file "Calendar" of folder "Database Programs"}
duplicate the selection to folder "Database Backups" replacing true–If we proceed, ‘replacing true’ replaces the contents of the folder “Database Backups” end if
on error
display dialog "Backup cancelled!" with icon stop buttons {"OK"} default button {"OK"} giving up after 3
end try
end tell
tell application "FileMaker Pro" to activate
85160 comments to http%3A%2F%2Fwww.scriptsforapple.com%2Ffilemaker-pro-applescript-to-backup-files%2FFileMaker+Pro+AppleScript+to+Backup+Files2009-03-25+00%3A20%3A14adminhttp%3A%2F%2Fwww.scriptsforapple.com%2F%3Fp%3D85FileMaker Pro AppleScript to Backup Files
I simply want to mention I am just all new to blogging and honestly savored you’re web page. Almost certainly I’m planning to bookmark your blog . You surely come with very good articles. Many thanks for sharing your web-site.
Hello, I need to say that FileMaker Pro AppleScript to Backup Files | Learning AppleScript for Beginners is a really great location to slack from function I genuinely enjoy your weblog and I have already bookmarked it. Please, maintain it up to date a lot more usually. Thank you!
Wonderful blog, partner! FileMaker Pro AppleScript to Backup Files | Learning AppleScript for Beginners is really one thing. We are starting mine quickly i will surely backup parts of the one you have, lawfully of course
The best way to keep the records in every hospital is to have a backup copy of all the patients who had been confined. By doing so, you are helping the people for a quick recovery of the files in the future.
This script is OK so long as the files aren't open. Backing up open database files will most likely corrupt the backups, rendering them useless. This would be potentially disastrous to the backup routine if the backups are being replaced as well. I would add a trap to the script to make sure the files aren't running prior to backing them up.
In my own backup routines, I add a timestamp to the backup file names so you don't replace existing backups.
I simply bookmarketed your blog and wanted to claim that I even have really enjoyed reading your wordpress blog posts. By any means I’ll be subscribing to your feed rss now, thanks
I need to express my love for your particular sympathy giving assist to firmly persons that want relief regarding that state of great interest. Your special total commitment upto acquiring the letter all-around was exceedingly vital and actually has in each and every issue enabled ladies like me to get to at their likes and dislikes. This new friendly and friendly guidance indicates a great deal to me and very much alternative to my mates. Best wishes; from a lot of people.
Noted your personal website out of your acquaintances Fb linkage, it seems that you have got establishing fanbase and i also now undertsand the reason why Extremely useful content, many merit 1.
I should convey my love for your specific kindness giving assist upto people that require treatment about that zone of interest. Your special dedication to actually having the meaning all-around was pretty priceless and also has in each and every situation triggered ladies like me to get to over at their likes and dislikes. This new inviting and friendly coaching indicates a good deal with me and substantially excess upto my partners. Best wishes; from each one of us.
It a new idea! Just wanna say thank you for the news you have got posted. Just continue publishing one of these post. I will be a loyal reader, thanks a lot.
We simply shared your blog and wished to feel that I have really enjoyed reading this blog posts. By any means I’ll be subscribing to your feed rss now, thanks
Sup, I do think your website could be having mozilla firefox browser prediction challenges. While i research your site in Trip, this indicates fine however when prospect in The web Traveler, it possesses a few overlapping. I just wished to provide you a short goes right up! Other in that case which often, splendid website!
My hope is the idea that some participants in our community will be fascinated by submitting their scholarly styling possible presentation with the conference.
If you are more of a techy kind of person and are comfortable with using Terminal, here is a script you can use to easily create multiple folders:
First, for a single folder, type in: mkdir "Folder 1"
--or whatever you want to name your folder, this creates a new directory, which, in effect is a new folder.
To place multiple items in the 'Documents' folder:cd/Users/
Administrator/
Documents
mkdir "Folder 1" "Folder 2"
"Folder 3"To quickly create multiple folders, create a text file with the desired folder names (as many as you want) and name it something like 'folderList.txt'. Next type this in Terminal:cat folderList.txt |xargs mkdirOr you could create folders with the same prefix by entering:mkdir "Invoices " {"Corporate", "Individual", "Pro-Bono"}
AppleScript 1-2-3
Digg This!!
An AppleScript to Verify a Date
Run this in the Script Editor:
set dateRecord to (current date)
set defaultDate to (date string of dateRecord)
try
set apptDate to text returned of (display dialog "Enter appointment date:" default answer defaultDate buttons {"Set"} default button {"Set"})
set datetext to apptDate as text
date apptDate --if an invalid date is entered, the next dialog is aborted and it triggers the error alert below.
display dialog datetext & " is a valid date." with icon note buttons {"OK"} default button {"OK"}
on error
set alertText to "An error has occurred!"
set messageText to quote & datetext & quote & " is an invalid date."
display alert alertText message messageText as warning buttons {"OK"} default button "OK" giving up after 15
return
end try
Concept Drawing for iMac prior to Production
Fun HTML
Use this to add interest to your pages, but be careful, if you overdo it, it can make your page look gaudy, if not ridiculous!
Read All About It
Here's is the code as it appears above:
<p align="center" style="padding: 5px; background-color: #FFCE9C; border: dotted 5px #FFCE9C;"><marquee width=20% behavior=scroll direction=left loop=infinite> Latest Headlines... </marquee><blink>Read All About It</blink>/p>
Copy and paste this into the Script Editor and try it out:
set defaultVolume to "3"
set volumeLevel to text returned of ¬
(display dialog ¬
"Set the system volume to (7 is the highest):"¬
default answer defaultVolume with icon note¬
buttons {"OK"} default button "OK") as integer
set volumeValues to {0, 1, 2, 3, 4, 5, 6, 7} ¬
as list
if volumeLevel is not in volumeValues then ¬
set volumeLevel to defaultVolume
tell application "Finder"
try
set volume volumeLevel
beep 2
on error errDlog
display dialog errDlog with icon stop ¬
buttons {"Abort"} default button ¬
"Abort" giving up after 15
end try
end tell
Six-figure Yaro Starak Teaches You How To Set Up And Profit From A Successful Blog. Start Making Money From Blogs By Following This Step-by-step, Weekly Coaching Program
Heres an AppleScript for backing up a selected group of HyperCard files. this was used in one of my HyperCard stacks, but could be adapted for use in OSX programs with little or no modification:
send "suiteBkp(true)" to bg btn "BackupSuite"
--Use this line to call the handler below (true displays a notification dialog when the process is complete, you must have a button named bg btn "BackupSuite"):
on suiteBkp(theBoolean)
copy line 1 of field "selectedFolder" to theHFFolderPath --You'll need a hidden field named "selectedFolder" that a script (prior to the call) will place the path to the desired folder in.
tell application "Finder"
activate
set todaysDate to (current date)
set bkpYear to (year of todaysDate)
set monthlyBkp to ("Monthly Reports_" & bkpYear) as string
if exists (folder "HyperCard Backup") then
select folder "HyperCard Backup"
delete selection
end if
if exists (folder "HyperCard Backup" of folder theHFFolderPath) then
select folder "HyperCard Backup" of folder theHFFolderPath
delete selection
end if
make new folder at folder theHFFolderPath with properties {name:"HyperCard Backup"}
select {file "Appointments" of folder theHFFolderPath, ¬ file "HyperFile" of folder theHFFolderPath, ¬ file "Outstanding Invoices" of folder theHFFolderPath, ¬ file "Year" of folder theHFFolderPath, ¬ file monthlyBkp of folder theHFFolderPath, ¬
copy selection to folder "HyperCard Backup" of folder theHFFolderPath
select folder "HyperCard Backup" of folder theHFFolderPath
select file "Appointments" of folder ¬ "HyperFile Suite Backup" of folder theHFFolderPath
set name of selection to "Appointments.bkp"
select file "HyperFile" of folder "HyperCard Backup" of ¬ folder theHFFolderPath
set name of selection to "HyperFile.bkp"
select file "Outstanding Invoices" of ¬ folder "HyperFile Suite Backup" of folder theHFFolderPath
set name of selection to "Outstanding Invoices.bkp"
select file "Year" of folder "HyperFile Suite Backup" of ¬ folder theHFFolderPath
set name of selection to "Year.bkp"
set prefMonthlyBkp to (monthlyBkp & ".bkp") as string
select file monthlyBkp of folder "HyperFile Suite Backup" of ¬ folder theHFFolderPath
set name of selection to prefMonthlyBkp
select folder "HyperFile Suite Backup" of folder "The HyperFile Folder"
move selection to desktop
end tell
if theBoolean = "true" then
tell application "HyperCard"
activate
display dialog ¬ "Your backup has been saved to desktop." buttons {"Done"} default button {"Done"} with icon 129 giving up after 10
end tell
end if
end suiteBkp
The classic Apple IIc (1981), part of a series of Apple computers that preceded the debut of the Macintosh
HyperCard Users Corner:
Here's a simple, but very useful little HyperTalk script for verifying the validity of a date entered by a user, assuming that you have a menu item "flag date..." (or whatever you choose to name it) or it could be altered slightly and placed within a mouseUp statement:
if menuItem = "Flag Date..." then
global tryDate
ask "Enter a date for your new appointment:" with the long date
if it ≠ "" and the result ≠ "Cancel" then
put it into tryDate
else
put "" into tryDate
exit doMenu
end if
if invalidDate() then
answer "The date entered is not valid!"
put "" into tryDate
exit doMenu
end if
--Here you would put the statements to execute if the entered date proves to be valid
put "" into tryDate
end if
function invalidDate
global tryDate
convert tryDate to short date
if the result = "invalid date" then
return true
else
return false
end if
end invalidDate
Mac SE (circa 1987), was a more advanced version of the Mac Plus and had an internal hard drive.
YouTube Video Search Script:
tell application "Finder"
try
set webSearch to text returned of (display dialog "Enter YouTube Video
Search" default answer "" buttons {"Search", "Cancel"} default button 1)
open location "http://www.youtube.com/results?search_query=" & webSearch
on error theError
display dialog theError
end try
end tell
I simply want to mention I am just all new to blogging and honestly savored you’re web page. Almost certainly I’m planning to bookmark your blog . You surely come with very good articles. Many thanks for sharing your web-site.
Your web site is among the a form, i really enjoy the method that you manage the topics.
Hello, I need to say that FileMaker Pro AppleScript to Backup Files | Learning AppleScript for Beginners is a really great location to slack from function
I genuinely enjoy your weblog and I have already bookmarked it. Please, maintain it up to date a lot more usually. Thank you!
Wonderful blog, partner! FileMaker Pro AppleScript to Backup Files | Learning AppleScript for Beginners is really one thing. We are starting mine quickly i will surely backup parts of the one you have, lawfully of course
Some of us even don’t realize the importance of this information. What a pity.
The best way to keep the records in every hospital is to have a backup copy of all the patients who had been confined. By doing so, you are helping the people for a quick recovery of the files in the future.
Hi, good post. I have been wondering about this issue,so thanks for posting.
This script is OK so long as the files aren't open. Backing up open database files will most likely corrupt the backups, rendering them useless. This would be potentially disastrous to the backup routine if the backups are being replaced as well. I would add a trap to the script to make sure the files aren't running prior to backing them up.
In my own backup routines, I add a timestamp to the backup file names so you don't replace existing backups.
My fellow on Facebook shared this link and I’m not dissapointed at all that I came here.
[...]always a massive fan of linking to bloggers that I like but don?t get a whole lot of link like from[...]
I simply bookmarketed your blog and wanted to claim that I even have really enjoyed reading your wordpress blog posts. By any means I’ll be subscribing to your feed rss now, thanks
I need to express my love for your particular sympathy giving assist to firmly persons that want relief regarding that state of great interest. Your special total commitment upto acquiring the letter all-around was exceedingly vital and actually has in each and every issue enabled ladies like me to get to at their likes and dislikes. This new friendly and friendly guidance indicates a great deal to me and very much alternative to my mates. Best wishes; from a lot of people.
Noted your personal website out of your acquaintances Fb linkage, it seems that you have got establishing fanbase and i also now undertsand the reason why Extremely useful content, many merit 1.
I should convey my love for your specific kindness giving assist upto people that require treatment about that zone of interest. Your special dedication to actually having the meaning all-around was pretty priceless and also has in each and every situation triggered ladies like me to get to over at their likes and dislikes. This new inviting and friendly coaching indicates a good deal with me and substantially excess upto my partners. Best wishes; from each one of us.
The sense of intending to assist, however not determining how as well as place, is one area a number of us are going through.
It a new idea! Just wanna say thank you for the news you have got posted. Just continue publishing one of these post. I will be a loyal reader, thanks a lot.
Thanks, You haven’t supposed to achieve this, however I believe you encounter could express the mind-set that many of persons are really in.
We simply shared your blog and wished to feel that I have really enjoyed reading this blog posts. By any means I’ll be subscribing to your feed rss now, thanks
Sup, I do think your website could be having mozilla firefox browser prediction challenges. While i research your site in Trip, this indicates fine however when prospect in The web Traveler, it possesses a few overlapping. I just wished to provide you a short goes right up! Other in that case which often, splendid website!
My hope is the idea that some participants in our community will be fascinated by submitting their scholarly styling possible presentation with the conference.