Applescript your Calendar Colours

Calendars
If you create multiple calendars in iCal, they are automatically assigned different colours. This allows you to easily figure out which events belong to which calendar. The problem is that iCal only uses seven different calendar colours. If you have eight or more calendars, iCal will use these same colours multiple times making it harder to work out which events are from which calendar.



iCal Colours
Now iCal does allow you to set a calendar to a colour other than the seven automatic ones, but you have to do this to each calendar manually. To do this, select the calendar from the list and choose "other" from the colour menu in the Info drawer/panel. This is pretty time consuming if you have a lot of calendars, and the more you have, the harder it is to make sure you don't use the same colour twice.


A more interesting way to solve this problem is by using randomly generated colours. To do this, we'll need to write a quick, easy AppleScript.

If you are using Mac OS X 10.3 or later, simply click this link to automatically open up Script Editor with a window containing the script you need.

If you are using an older version of Mac OS X, load up Script Editor (from /Applications/Applescript) and paste the following script into the window that appears:

tell application "iCal"
set calnum to (count every calendar)
repeat with currentnum from 1 to calnum
set calcolour to (the color of every calendar)
set red to random number 65535
set green to random number 65535
set blue to random number 65535
repeat until calcolour does not contain {{red, green, blue}}
end repeat
set red to random number 65535
set green to random number 65535
set blue to random number 65535
set the color of calendar currentnum to {red, green, blue}
end repeat
end tell


Now all you need to do is click Compile (the hammer icon) and then click Run. iCal will load up and each of your calendars will be assigned a new colour. It doesn't work perfectly - sometimes two colours will be very similar. However it is much more fun than going through each calendar individually and this is a great example of just how powerful AppleScript can be.
|

Get Custom Audio or Visual Alerts

Create your own alert sound
Whenever Mac OS X wants to get your attention, it plays an alert sound. For example it does this when a dialog box appears, when you receive an email and as an iCal alarm. Your Mac comes with a nice set of alert sounds, but after a while they may get a bit boring.

You can add your own alert sounds by placing audio files in a certain folder. Before you do that however, you will need to convert your sound file to the AIFF format using iTunes. Open up iTunes and choose Preferences from the iTunes menu. In the Advanced section, click on the Importing tab and choose AIFF encoder from the pop-up menu. Click OK.

AIFF encoder

Convert to AIFF

If the audio file you want to use is in iTunes, select it and then click on the Advanced menu. In here choose Convert selection to AIFF. If you audio file is somewhere else, hold Option while clicking on the Advanced menu and choose Convert to AIFF. This will bring up a dialog that will allow you to navigate to your audio file. Once the file is done converting, go back to the preferences and change the "Import Using" pop-up menu back to AAC.

Now we have to get this file to show up in the Alerts list in System Preferences, Mail and iCal. Open up your user folder, look in the Library for a folder called Sounds and drag the sound here from iTunes. Your new alert should now be in the list in the Sounds section of System Preferences.



Make your alerts visual
An alternative to the audio alert is a visual alert, which is basically a screen flash. You can turn this on in the Universal Access section of System Preferences, under the Hearing tab. This will flash the screen as well as playing an alert sound. If you want to get rid of the sound and just have the flash, go to the Sounds section of System Preferences and move the Alert Volume Slider all the way to the left.

Alert Volume

Annoyingly, this will also mute the feedback you get when the volume is changed and the interface sound effects (like when you move something to the trash). If you're fine with this then use the method above. However if you still want these other sound effects, there is a better (but more complicated) solution.

Mac OS X will also flash the screen if for some reason it is unable to play the selected audio alert. To make this happen, open up TextEdit and press Command-Shift-T to convert the document to plain text. Save this empty file as Flash.aiff in the sounds folder inside your Library. If a dialog asks you which extension to use, choose .aiff.

Save Flash.aiff

Now if you look in your alerts list in System Preferences there will be an alert called Flash that does exactly that - flash the screen. This is because Flash.aiff isn't really a sound file. When your Mac tries to play it and can't, it flashes the screen instead to make sure you still see an alert.

|

Peek inside Mac OS X Packages

For those who don't know, Mac OS X packages are simply folders disguised to look like single files. The most common examples are applications. They are just folders containing all the data files for the application that open up as an application rather than folder when you double-click them in the Finder.

Packages are great because they allow the developer to store all the important related files inside the application. They are also great because they make it very easy to tinker with the way applications work.

To view or edit a package's contents, Control-click (or Right-click) on the application and select Show Package Contents from the context menu. This will bring up a finder window containing a folder named Contents. Inside here is the actual package contents.

The following are a few examples of what you can do inside Mac OS X packages.

Warning: It is a good idea to keep a backup of any file you modify. To do this, just Option-drag the file to copy it to a safe place before making any changes to the original.

1. Change Unexpectedly Quit message
With some tinkering it is possible to customize Mac OS X alert messages and dialog box text. For a bit of fun, you can change the message that appears when an application crashes to something more humorous.

Open up your hard drive and navigate to /System/Library/CoreServices. Find the Crash Reporter package and open it by Control-clicking (or right clicking) and choosing Show Package Contents.

In the window that appears, navigate to Contents/Resources/English.lproj and find Localizable.strings. Copy it to your Desktop and open it up in TextEdit. Near the bottom of the file you will see the line -

/* Unexpectedly quit dialog */

In the lines that follow this it is fairly obvious how to change the message. The symbol "%@" will make the message display the crashed Application's name, and "\n" will make a line break. Save the file and then copy it back to the package to replace the old version. You will have to enter your administrator password.

Unexpectedly Quit Message


2. Change an application's default icon
You probably know how to change an application's icon by opening up its Get Info window (Command-I), clicking on the icon and pasting a new one over it. You can use the Cut tool (Command-X) to remove this icon and return to the default. To change this default icon, you have to delve into the package. The icon file is stored in the Resources folder within the package contents, and normally has the same name as the application with the .icns extension. You can replace this file with any other icon file, whether it is downloaded from the Internet or taken from another application.

If you dislike the way the iCal icon always displays the date as July 17 when it isn't open, there is an alternative icon inside the iCal package. If you look inside the Resources folder you will find two icons - App.icns and App-empty.icns. To change which one iCal uses, simply rename App.icns something like AppJul17.icns and make a duplicate of App-empty.icns named App.icns.

Some people also dislike the iTunes 7 icon. This Mac OS X Hints article describes how to change it back to the one used in iTunes 6.


3. Open help files in a Web browser
Anyone who has ever used the Mac OS X help browser will admit that it is a little on the slow side. Annoyingly, it also lacks a Save command, meaning you have to go through the slow process of loading it up and finding what you want every time. Luckily, the help pages are just HTML files stored away inside the application's package. This means you can open them up in Safari, which is much quicker for browsing and allows you to save bookmarks and Save pages.

For example, to open up the iPhoto help, open up the iPhoto package in your Applications folder. Then navigate to the English.lproj folder inside the Resources folder. Here you'll find a folder called iPhoto Help with a file named iPhoto Help.htm inside. Double-click on this file to open it up in Safari.

iPhoto Help

Annoyingly, every now and again a link will open up in Help Viewer, but generally you can browse the help files from within Safari.

Things like Airport, Applescript, Bluetooth, iPod and Mac OS X itself don't have an Application package to store the help files in, so these are located in the Library folder. To find them, go to your Hard drive and look inside Library/Documentation/Help. Each of the .help files in here is a package.


4. Change Text Clipping Behaviour
Text Clipping
This previous tip explains how to make selections within Text Clippings by changing a file within the Finder Package. Normally you can only copy and paste the entire clipping, but by changing one line in a file, you can enable making selections within clippings.

5. Customize System Preferences
All the System Preferences panes are grouped into five categories - Personal, Hardware, Internet and Network, System and Other. It is quite easy to change these category names by going inside the System Preferences package, which is in the Applications folder. Inside it, navigate to the English.lproj folder inside the Resources folder. In here, find a file named NSPrefPaneGroups.strings and drag it to your desktop. Now open this file up in TextEdit and you'll see the following lines:

"personal" = "Personal";
"digitalHub" = "Digital Hub";
"hardware" = "Hardware";
"net" = "Internet & Network";
"system" = "System";
"addons" = "Other";

Don't change the words on the left, these are the ones used by System Preferences. You can change the words on the right. These are the ones displayed in the System Preferences window. Just make sure you don't delete any quotes or semicolons. Also, ignore the "Digital Hub" entry. This isn't used anymore and is probably just left over from a previous version of the operating system.

Now save the file and drag it back to the English.lproj folder from the Desktop. You will have to Authenticate this action with your administrator password.

6. Modify iCal alarm message
iCal Alarm
You can customize the alarm message in iCal to show something else instead of the alarm clock. First, create a Quicktime movie that is roughly 53 pixels wide and 66 pixels high, and save it as alarmclock.mov. Locate iCal in your Applications folder open up its package. Go to the Resources folder and locate the alarmclock.mov file that is already in there. Replace this with your new alarmclock.mov file.


Picture 2A wide range of packages exist to buy domain name. There is a list of domain tools that can help you achieve your results. A proper selection of domain name hosting company is essential. On that note, make sure you have an antivirus software that will protect your system. Try some tests that will keep you well-equipped to deal with system problems. Some names are worth mentioning: 156-315, MB2-421, 70-431.

|

Merge Two iCal Calendars

iCal Icon
One of the difficulties of creating multiple calendars in iCal is working out how many you actually need. Do you create a "College" calendar and a "Homework" calendar, or should you make just one for all you college activities?

If you start off with two separate calendars it is fairly easy to merge them into one if you later decide to. Luckily you don't need to go through every single event and change the details. You can do them all in one with the export command.

First choose the calendar you want to get rid of. Select it in the calendars list, and go to the File menu and choose Export. Choose any name and location. You aren't going to need this file for very long, so save it somewhere like the desktop so you can easily get to it.

Now you are going to re-import the events into the calendar you are merging them with. Go to the File menu and choose Import. Navigate to the file you saved earlier, and click Import again. In the dialog box that appears, choose the Calendar you want to merge the events into.

If everything went OK and all the events are in one calendar, you can safely delete the other one.
|

5 Quick iCal Tips

1. You can create line breaks in an iCal event by pressing Option-Return. Handy if you want to create a small list in an event.

iCal Event

2. If you are really worried about missing an event, set more than one alarm for it. In the info panel for your event click on the word "alarm" and a menu will appear allowing you to add or remove alarms. You can even set alarms to go off after the event, for example if you need to drop someone off and then be reminded go pick them up an hour later.

Set iCal Alarm
3. Use iCal to schedule things on your Mac. When setting an alarm for an event, you can choose the option for it to "Open a file". You could create an Applescript or Automator workflow that loads up iTunes and plays a random song or create a shortcut to a web site by dragging the address from Safari to the Finder. Create an event that occurs every morning at 7.00 and set this file as the alarm.

4. While iPhoto is great for printing pretty calendars, iCal offers a special customized print dialog that gives you much more flexibility in printing your calendars, albeit without the lovely photos. Check out this previous tip for printing To Do lists in iCal.

iCal Alarm
5. You can customize the alarm message in iCal to show something else instead of the alarm clock. First, create a Quicktime movie that is roughly 53 pixels wide and 66 pixels high, and save it as alarmclock.mov. Locate iCal in your Applications folder and Control-Click (or Right-Click) on its icon. From the context menu, choose Show Package Contents. Go to the resources folder and locate the alarmclock.mov file that is already in there. Replace this with your new alarmclock.mov file. You will probably want to keep a backup of the old file if you even want to go back to the ringing alarm clock.

|

Printing To Do lists in iCal

iCal offers a special customised print dialog, allowing you to print calendars and to do lists in a number of different ways. While iPhoto offers a nicer way to publish complete calendars, the print options in iCal give a great way to print to do lists.

ical-print
Start by going to File --> Print or hitting Command-P. A large preview window appears, with many options down the right hand side. The default settings will print a normal calendar in month view. To change this to a simple to do list, change the first popup menu from Month to List. Choose your date range using the settings below, and uncheck all the boxes in the Options sections apart from "To Dos".

ical-options
Your page will show all to dos dated in the range you specified, as well as any undated to dos. If you don't want any of the undated to dos to show up you can delete them, or move them to another seperate calendar that isn't set to print.
|

Automate your Mac

We all have to admit that we are pretty lazy at times, and would love to make our computers do stuff automatically. And because we are lazy, we can't be bothered with stuff like Applescripts that are far too much effort to create. Here are a few tips to automate your Mac and make your life that little bit easier without going over the top with scripting.

The first thing to do is to make your Mac turn on by itself. You can set it to do this in the Energy Saver preference pane in System Preferences. Just load it up and click "schedule" and choose a time to start up (and/or shutdown) and on which days you want this. This will also wake up your Mac if it is asleep, but this might not work if you have a password enabled screensaver.

energy saver schedule system preferences


Picture 2
Instead of loading up the same web browser, email client and iTunes every time you start up your computer, you can set them as login items in the Accounts preference pane. Choose the login items tab, click the plus and select the applications you want to automatically start up. Popular ones are Mail or Entourage, Firefox or Safari and iCal.



Picture 1

As far a scheduling specific applications goes, you have to use applescripts or automator actions for most of them. If you aren't completely super lazy, it is pretty straightforward to create a workflow in automator that opens up a list of websites, or starts an iTunes playlist going. To get this worklow to be carried out at a certain time, create an event in iCal and set an alarm. As the alarm action, set it to open up the automator file.

However, in some applications you can get the same results without making workflows or scripts. For example, in Firefox you can set multiple websites as your homepage, and all of these will open up when you start Firefox. There are two ways to do this. The first is to create a folder of bookmarks with all the sites you want to load on startup. After creating this folder, go to the Firefox preferences and click "use bookmark" to select the folder. The alternative way is to type in each address into the homepage field with a | (pipe) in between. Be sure to set Firefox to load your homepage on startup using the dropdown menu.

Picture 3

Finally, some applications have built in scheduling capabilities. Microsoft Entourage has tools to set Send and receive schedules that check for email at certain times and Apple's Backup has its own scheduling feature to carry out automatic backups however frequently you want.

You can use all of these features to automate your Mac and make sure that you never have to carry out a tedious task again.

|

Top iCal Tips

Merlin Mann has made a list of Best iCal Tips over at 43 Folders, his site about personal productivity. The site is great for blog postings about staying productive and "getting things done" (GTD), and he recommends using iCal as a great way of doing this.

The list of tips includes ways of getting the most out of iCal, organising multiple calendars and scheduling a "dash," a way to prevent procrastination.
|

Scheduled Startup and Shutdown

In the Energy Saver system preferences you will find a button labelled "Schedule." This allows you to schedule your mac to startup and shutdown at certain times, on certain days.

This is just about the only way to schedule things without buying other software or using iCal. Basically you can set your computer to come on in the morning on weekdays and go off in the evening for example.

I combine this with a locked screen saver. In the evening I start my "Big Clock" screensaver, then put my mac to sleep. In the morning it wakes up at a specified time, and loads the password dialog box. Then, when no password is typed in, it goes to the screen saver after 30 seconds. This means when I wake up in the morning I can look over and see the time in big bright letter next to me, without them on all night to wake me up.

You can also combine this with an applescript or automator actions to play music or load web pages every morning. After writing the script to do this, set a daily alarm in iCal that loads it every morning, but make sure to make it a minute later than the time your mac wakes up from sleep.
|