Entourage - script to open another users calendar

Greetings Applescripters!

It’s been ages since I’ve done any Applescripts (OS9), and even then I didn’t do a lot.

Currently using William Smith’s handy Entourage Exchange Setup 2.0, which after a few settings and one slight mod, seems to be working perfectly.

However, when setting up an Entourage account, an additional task I would normally perform would be to open several calendars from other accounts (shared calendars for scheduling conference rooms). This can take a while. In Entourage, this would be performed by selecting File > Open Other Users Folder., entering (or looking up) the name of the “users” account, setting the type to calendar, and saying OK. Each “user” account to be imported only contains one calendar.

The Entourage library looks temptingly like this can be done, but my skills are pretty non-existent when starting from scratch.

Thanks for any insight you can offer!

AppleScript: 2.0.1
Browser: Firefox 3.0.10
Operating System: Mac OS X (10.5)

So far, I have a few tries:

tell application "Microsoft Entourage"
	open every calendar with properties
	{name:"Name of Account"}
end tell

Which doesn’t error, but doesn’t really do anything. I believe I’m just telling Entourage to open a calendar named “Name of Account”, but not telling it to open another account’s calendar.


tell application "Microsoft Entourage"
	open every calendar of Exchange account with properties
	{name:"Name of Account"}
end tell

Gets an error “can’t get every calendar of Exchange account”, which just reminds me I don’t really know what the heck I’m doing. :confused:

Well, after doing some more research, it appears that Entourage can’t open some menus directly via Applescript, including the one I wanted.

However, I also got into learning about System Events to end around that, and from various examples and some help from a demo of UI Browser (which I’ll try and pick up if I need to do this in the future), I got to the place where I wanted. Ran into some issues waiting for the calendars to add, but some delays and having it wait for the window to appear helped that out. I also read up a little on variables and looping, which helped condense the script down to a reasonable size.

Here it is:

set CalendarRoomList to {"First Calendar", "Second Calendar", "Third Calendar", "Forth Calendar", "Fifth Calendar"}

tell application "Microsoft Entourage" to activate

repeat with CalendarRoom in CalendarRoomList
	tell application "System Events"
		tell application process "Microsoft Entourage"
			click menu item "Open Other User's Folder..." of menu 1 of menu bar item "File" of menu bar 1
			repeat while not (exists window "Open Other User's Folder")
			end repeat
			delay 1
			set value of text field 1 of window "Open Other User's Folder" to (contents of CalendarRoom)
			click button "OK" of window "Open Other User's Folder"
			delay 4
		end tell
	end tell
end repeat

Of course, I replaced “First Calendar” and so on with the actual names of the shared calendars. In my case, we have nine of 'em to load up each time we configure Entourage, so this should help.

Nobody may have replied to my posts with specific info, but the site and it’s discussion archives (along with various others on the web) were invaluable, to thanks! :smiley: