Posted on Sun - November 13, 2005 Time folder restoreHere is the sibling script to the backup time
folder. It is not totally automated, you have to drag the xfer folder created
by the other script to the desktop. Since I usually work from a disk image or
an archive, it works for me.
After you run this script, you should log out and log back in so the applications don't try to use the trashed files. It's pretty obvious but I will walk you through
it.
First the script checks to see if something is there on the desktop to be transfered. This whole script is a series of nesting if/then statements, so at first glance things may look a little out of order. tell
application
"Finder"
activate
if
folder
"Users:neo:Desktop:xfer"
exists
then
I don't like major changes happening without my permission, so up comes a dialogue before deleting files. display
dialog "Are you sure? This will overwrite your
existing project files."
buttons
{"NEVER", "Go for it!"} default
button "NEVER"
set
XferState
to
(button
returned
of
result)
if
XferState
is
"Go for it!"
then
You have to have the script test that the file exists before deleting, otherwise the script will hang when it tries to delete a nonexistent file. if
folder
"Users:neo:Projects"
exists
then
delete
"Users:neo:Projects"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:Projects"
to
folder
"Users:neo"
if
folder
"Users:neo:Library:Safari"
exists
then
delete
folder
"Users:neo:Library:Safari"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:Safari"
to
folder
"Users:neo:Library"
if
folder
"Users:neo:Library:Scripts"
exists
then
delete
folder
"Users:neo:Library:Scripts"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:Scripts"
to
folder
"Users:neo:Library"
if
folder
"Users:neo:Documents:Palm"
exists
then
delete
folder
"Users:neo:Documents:Palm"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:Palm"
to
folder
"Users:neo:Documents"
if
folder
"Users:neo:Library:Application Support:iBlog"
exists
then
delete
folder
"Users:neo:Library:Application Support:iBlog"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:put in library-application support:iBlog"
to
folder
"Users:neo:Library:Application Support"
if
file
"Users:Neo:Library:Preferences:com.lifli.iBlog.plist"
exists
then
delete
file
"Users:Neo:Library:Preferences:com.lifli.iBlog.plist"
end
if
duplicate
file
"Users:neo:Desktop:xfer:put in library-preferences:com.lifli.iBlog.plist"
to
folder
"Users:Neo:Library:Preferences"
if
folder
"Users:neo:Sites:iBlog"
exists
then
delete
folder
"Users:neo:Sites:iBlog"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:iBlog"
to
folder
"Users:neo:Sites"
if
folder
"Users:neo:Pictures:webgrfx"
exists
then
delete
folder
"Users:neo:Pictures:webgrfx"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:webgrfx"
to
folder
"Users:neo:Pictures"
if
folder
"Users:neo:Sites:neowaylanddotnet"
exists
then
delete
folder
"Users:neo:Sites:neowaylanddotnet"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:neowaylanddotnet"
to
folder
"Users:neo:Sites"
if
folder
"Users:neo:Sites:frame pages"
exists
then
delete
folder
"Users:neo:Sites:frame pages"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:frame pages"
to
folder
"Users:neo:Sites"
Then the script cleans up after itself. delete
folder
"Users:neo:Desktop:xfer"
say
"All files updated."
Now to deal with the uncompleted if/then statements. The next one is the response to the dialogue box. else
say
"Canceling updates"
end
if
And the last one (which was actually the first question asked) was the test to see if the folder xfer existed on the desktop. else
say
"Nothing on the desktop to transfer"
end
if
end
tell
And that is it. Here is the whole script in a block. tell
application
"Finder"
activate
if
folder
"Users:neo:Desktop:xfer"
exists
then
display
dialog "Are you sure? This will overwrite your
existing project files."
buttons
{"NEVER", "Go for it!"} default
button "NEVER"
set
XferState
to
(button
returned
of
result)
if
XferState
is
"Go for it!"
then
if
folder
"Users:neo:Projects"
exists
then
delete
"Users:neo:Projects"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:Projects"
to
folder
"Users:neo"
if
folder
"Users:neo:Library:Safari"
exists
then
delete
folder
"Users:neo:Library:Safari"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:Safari"
to
folder
"Users:neo:Library"
if
folder
"Users:neo:Library:Scripts"
exists
then
delete
folder
"Users:neo:Library:Scripts"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:Scripts"
to
folder
"Users:neo:Library"
if
folder
"Users:neo:Documents:Palm"
exists
then
delete
folder
"Users:neo:Documents:Palm"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:Palm"
to
folder
"Users:neo:Documents"
if
folder
"Users:neo:Library:Application Support:iBlog"
exists
then
delete
folder
"Users:neo:Library:Application Support:iBlog"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:put in library-application support:iBlog"
to
folder
"Users:neo:Library:Application Support"
if
file
"Users:Neo:Library:Preferences:com.lifli.iBlog.plist"
exists
then
delete
file
"Users:Neo:Library:Preferences:com.lifli.iBlog.plist"
end
if
duplicate
file
"Users:neo:Desktop:xfer:put in library-preferences:com.lifli.iBlog.plist"
to
folder
"Users:Neo:Library:Preferences"
if
folder
"Users:neo:Sites:iBlog"
exists
then
delete
folder
"Users:neo:Sites:iBlog"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:iBlog"
to
folder
"Users:neo:Sites"
if
folder
"Users:neo:Pictures:webgrfx"
exists
then
delete
folder
"Users:neo:Pictures:webgrfx"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:webgrfx"
to
folder
"Users:neo:Pictures"
if
folder
"Users:neo:Sites:neowaylanddotnet"
exists
then
delete
folder
"Users:neo:Sites:neowaylanddotnet"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:neowaylanddotnet"
to
folder
"Users:neo:Sites"
if
folder
"Users:neo:Sites:frame pages"
exists
then
delete
folder
"Users:neo:Sites:frame pages"
end
if
duplicate
folder
"Users:neo:Desktop:xfer:frame pages"
to
folder
"Users:neo:Sites"
delete
folder
"Users:neo:Desktop:xfer"
say
"All files updated."
else
say
"Canceling updates"
end
if
else
say
"Nothing on the desktop to transfer"
end
if
end
tell
|
Hello There
This is my no frills blog to cover all the gadgets and gizmos and technology that makes 21st Century life so exciting. Think of it as a messy set of notes that I keep for myself on all sorts of topics. It's really intended for my personal use, but I will explain sometimes as I go along.
My passion is for Macintosh and other Apple products, but I will use others as needed. If my notes and experiences can help or amuse you, so much the better. Categories
Calendar
Archives
XML/RSS Feed
Neolinks
Homepage AOL Homepage Geocities Homepage Dot Mac Homepage PaganVigil AOL Pagan Vigil Geocities Pagan Vigil Dot Mac Pagan Vigil Technopagan Yearnings AOL Technopagan Yearnings Geocities Technopagan Yearnings Dot Mac Technopagan Yearnings Webmaster NetworkSolutions Dot Mac dotmac.info WhatTheFont MacHighway America Online Yahoo! Geocites ZoneEdit iBlog HaloScan StatCounter Feed to JavaScript Performancing Design Re-Imagineering Steampunk Workshop Design Observer Subtraction Paleo-Future Hardware Apple CDW Cyberguys PCMall X-Treme Geek Software TypeStyler Graphic Converter Palm News & Info Palm Infocenter Brighthand Forums - Palm mytreo.net Making Music Apple - iLife - GarageBand iCompositions Royalty Free Music, Free Sound Effects, Royalty-free Sounds Tune Up Loops Twin Cities MIDI Home Page Andy's OSX Music Page Apple Logic Pro - AUDIO Hints & Tips Library of scanned player piano music rolls Garritan Orchestral Libraries Drums on Demand Bandmateloops Coolness Gizmodo Engadget Daring Fireball RoughlyDrafted Magazine Applefritter iGeek MaKiDo Mac vs. PC Info Why I Hate Microsoft World of Ends Tracking What Is My IP Address? IP Address Trace Geektools WHOIS ARIN WHOIS Database Search Zabra People Search NeoBlogs
Statistics
Total entries in this blog:
Total entries in this category: Published On: Dec 07, 2008 01:28 PM |