Cidney: AppleScript

In addition to being a flexible notification tool, Cidney can also take specific actions on incoming calls using AppleScript. For example, if you wanted Cidney to send you an e-mail when you get a call from someone specific, you can use AppleScript to do this.

The general form of these scripts is as follows:

on incoming_call(caller_name, caller_number, caller_id)
	if (caller_id is not "") then
		tell application "Address Book"
			set p to the first person whose id = caller_id

			-- do something with the identified person
		end tell
	else
		-- do something else
	end if
end incoming_call

In the script above, caller_name is a string parameter that reflects the name of the caller as reported by the Caller ID system. caller_number is the originating phone number, and caller_id is the unique record identifier of an Address Book entry. If Cidney cannot find the caller in the Address Book, this is the empty string "".

If you wanted to send an e-mail when you get a call from Santa Claus, the script would be something like this:

on incoming_call(caller_name, caller_number, caller_id)
	if (caller_name is "Santa Claus") then
		tell application "Mail"
			activate
			set newMessage to make new outgoing message 
				with properties {subject:"Santa called",
				content:"Santa Claus called. You should 
				call him back."}
	
			tell newMessage
				make new to recipient at end of to recipients 
					with properties 
					{address:"cjkarr@mac.com"}
		
				set visible to true
			end tell
			send newMessage
		end tell
	end if
end incoming_call

After the script is finished, it should be placed in the folder

Library/Application Support/Cidney/AppleScript

within your home directory.

Note that you can place as many scripts as you like in this folder. Each script is called for each incoming call (all incoming calls, not just filtered calls). Scripts are called in alphabetical order, so a.scpt will be executed before b.scpt.

Cidney Home