ClickMail Central Directory | Info | Download | Links | Support | Feedback
Gracion Software Home

AppleScript and ClickMail

ClickMail 1.2 introduces scriptability to ClickMail. Text file import and export is now scriptable, as are application preferences, backup, compact, reindex, and AppleShare IP resync. This support is designed to assist in automated movement of data between other applications and ClickMail. Access to the database itself is not supported in this version.

For command and syntax information, view ClickMail's dictionary in the Script Editor (drag ClickMail C.D. to it). Preferences are seen as properties of the application. Two properties that impact import and resync operations are AppleShare new entry importing and AppleShare password copying.

Here's an example script that gets and sets some preferences:

tell application "ClickMail C.D."
	set administrator DN to "cn=Will Shakespeare, c=US"
	set backup hour to 23
	set backup minute to 59
	set backup daily to true
end tell

Here's an example export script. This exports tab-delimited file to location specified by hard coded full pathname. Only people entries are exported.

tell application "ClickMail C.D."
	set myPath to "Gee:Projects:CMDS:Testing:Apple Events:abc1" --is replaced if it exists
	export myPath format tabDelimited with people only
end tell

Here's another example export script. This exports an LDIF file, named in a choose file dialog. All entries (not just people entries) are exported. Displays number of records successfully exported (from result of export command).

tell application "ClickMail C.D."
	choose new file
	set myfile to the result
	-- Equivalent alias record if you were to hard code it:
	--     set myfile to {filename returned:"entries2.tab", 
	--     replacing:false, 
	--     folder returned:alias "Gee:Projects:CMDS:Testing:Apple Events:"}
	export myfile format LDIF without people only
	set myNote to "Exported " & (the result as string) & " entries."
	display dialog myNote
end tell

This script imports entries from a tab-delimited file you choose in a standard file dialog.

tell application "ClickMail C.D."
	choose file of type {"TEXT"}
	set myfile to the result
	import myfile format tabDelimited
end tell

Program Linking

Apple Events/AppleScript supports sending commands to programs over your network. You can send commands to ClickMail from a script running on another Mac. Here's an example:

tell application "ClickMail C.D." of machine "PowerCenter"
	resync
	get directory mode
	set myNote to "Resync complete. ClickMail's mode is " & ¬
		 the result & "."
end tell

display dialog myNote --can't tell this to a remote app.

In your script, specify the name of the host Mac and the AppleTalk zone, if any (machine "LDAP Server" of zone "Admin"). For Program Linking over TCP/IP, designate the host as required. The application must already be running, AppleScript won't launch it.

Program Linking has strict requirements. On the server Mac, Program Linking must be turned on in the File Sharing control panel and ClickMail's Get Info window (Sharing). Also, the user (or Guest if you're fearless) that you will log in as must have Program Linking enabled in Users & Groups (in the control panel, or AppleShare Web & File Admin's Users if you're running AppleShare IP). Note: If you have to cancel the Program Linking login, your script won't run or compile until you quit the Script Editor and relaunch it.

 


ClickMail Central Directory | Info | Download | Links | Support | Feedback
Gracion Software Home