请选择 进入手机版 | 继续访问电脑版

苹果发烧友论坛

 找回密码
 注册
查看: 5075|回复: 8

[程序] 如何让你的iCal可以自动备份

[复制链接]
发表于 2010-8-16 23:25:24 | 显示全部楼层 |阅读模式
本帖最后由 KidFores 于 2010-8-16 23:58 编辑

如何让你的iCal可以自动备份


作者:BusyMac 翻译:Kid



手动备份iCal


传统备份iCal的方法很简单:打开iCal ->文件 ->导出 ->iCal文件归档
需要浏览备份文件的话只需双击打开储存的备份文件即可,这对于偶尔备份iCal的同学来说还是挺简便的,不过需要每日都备份的话,会不会累了点?
没关系,AppleScript可以帮你解决每日烦躁的备份工作。

使用AppleScript自动备份iCal

当iCal运行时,这个脚本会帮助你备份iCal。你可以创建个每日重复事件,使用提醒功能来驱动脚本。以下是详细操作过程:

1 下载并保存 iCal Backup Script 这个文件到应用程序文件夹(或者任何你想保存的地方,只要确保 3 中脚本运行路径正确)


2 在iCal中创建一个每日循环的新事件 (例如 11:00 PM)


3 在新事件中将提醒设置改为运行脚本,选择其他,选中 1 中下载并保存的 iCal Backup Script


Ok 到这里你应该看到一个类似下图的事件细节


如果你完全按照如上的步骤设置,现在每晚的11点,iCal会运行AppleScript然后自动备份,并且iCal不需要事先打开来使脚本运行。

脚本默认设置备份文件储存在~/Documents/iCal Backups中,文件时间为所设置的时间(例如 iCal 2008-11-14 23.00.00.icbu)。这些文件会在文件夹中保存10天,10天后会自行删除。

设置你自己的AppleScript

如果你想改变备份文件的储存路径或者储存数量,只需用脚本编辑器打开下载的iCal Backup Script,然后修改下述行


如果想改变备份文件的储存路径,编辑这一行:
  1. set destDir to myHome & "Documents/iCal Backups"
复制代码
(Documents/iCal Backups为路径)
如果想改变储存备份文件的数量,编辑这一行:
  1. set deleteAfter to 10
复制代码
(10为储存数量)

好了,现在你可以解放双手了,让iCal自动备份,做些更有意义的事情,比如抱一下你的女朋友(笑,全文完)

原文地址:猛点我
(二楼原文文本)
applescript-icon.png
backupical.png
alarmtype.png
alarmtype.png
backupical2.png
applescript.png

评分

参与人数 1威望 +30 收起 理由
macing2010 + 30 精品文章

查看全部评分

 楼主| 发表于 2010-8-16 23:59:13 | 显示全部楼层
iCal Backup Script


Manually backup iCal

iCal allows you to create a backup file by selecting File > Back up iCal. You can later restore iCal by double-clicking the backup file. Restoring iCal from a backup works great as long as you have a recent backup. But that’s rarely the case.
What if you could configure iCal to create backups automatically? You can, with a little help from AppleScript.

Automatically backup iCal

This script will backup iCal when run. You can create alarms in iCal to run scripts. To configure iCal to back itself up every day, create a repeating alarm in iCal that runs this script. Here's how:
Save this iCal Backup script to your Applications folder.

Create a new event in iCal that repeats every day (e.g. 11:00 PM).

Set the Alarm type to Run Script. Then choose Other... and select the iCal Backup script stored in the Applications folder.

When finished, the Event Details should look something like this:

Now every night at 11:00 PM, iCal will run the AppleScript and back itself up. And, iCal does not have to be running for the script to run.
By default, the script creates backup files that are date and time stamped (iCal 2008-11-14 23.00.00.icbu) and stores them in ~/Documents/iCal Backups. It archives up to 10 day’s worth of backups and deletes the older backups.

Customize the AppleScript

If you want to alter the location of the backup directory or the number of archives to save, you can open the AppleScript with Script Editor (in /Applications/AppleScript) and change these variables:

To change the backup folder, edit this line:
  1. set destDir to myHome & "Documents/iCal Backups"
复制代码
To change the number of days to archive, edit this line:
  1. set deleteAfter to 10
复制代码
回复 支持 反对

使用道具 举报

发表于 2011-4-28 10:54:48 | 显示全部楼层
我学ix!
回复 支持 反对

使用道具 举报

QQ|小黑屋|手机版|Archiver|苹果发烧友论坛 ( 京ICP备16012027号-3 )

GMT+8, 2017-10-23 02:54 , Processed in 0.013448 second(s), 11 queries , Xcache On.

Powered by Discuz! X3.3 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表