A fix for iCal scripts running from cloned drives
Sep 03, '09 07:30:00AM • Contributed by: Anonymous
Sep 03, '09 07:30:00AM • Contributed by: Anonymous
I have several scripts I run at 5:00AM on various days that are started by iCal. I also have three hard drives on my Mac Pro, where DISK2 and DISK3 are clones of DISK1, created using SuperDuper.
Once a month, I verify all three of my disks. To verify DISK1, I will usually restart from DISK2 or DISK3. When I do this, even though it is long past 5:00AM, iCal will launch my scripts. This can foul things up, as all my scripts use absolute paths starting at DISK1.
I inserted the following bit of AppleScript at the beginning of all my scripts to avoid this problem:
Once a month, I verify all three of my disks. To verify DISK1, I will usually restart from DISK2 or DISK3. When I do this, even though it is long past 5:00AM, iCal will launch my scripts. This can foul things up, as all my scripts use absolute paths starting at DISK1.
I inserted the following bit of AppleScript at the beginning of all my scripts to avoid this problem:
tell application "Finder"
activate
set dtest to name of startup disk
if dtest = "DISK2" then return
if dtest = "DISK3" then return
end tell
This essentially quits the script before causing any problems.
•
[2,949 views]
