Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

10.4: Use Automator to help publish iCal calendars Apps
Tiger only hintDoes your web host not have WebDAV installed on Apache? It's not unusual; none of the hosts I use or looked at had mod-dav installed, nor were they willing to do so. That means that the one-click Publish feature in iCal won't work. You can, however, simply FTP the calendar to your desired location. That requires that you first find the calendar files, discover which one is the right calendar, FTP it to your server, and rename it to a descriptive, useful name. If you make changes to the calendar with any regularity, it's a major hassle. Read on and I'll walk you through the above, and show how to use Automator (OS 10.4.x only!) to return it to one-click functionality.

The first step is to find the calendar file. iCal uses an obfuscated naming structure for the calendar files, using what looks like an extremely long hex key for a unique folder for each calendar, and each folder contains: corestorage.ics (the actual calendar file), an Index file, and Info.plist, which contains the name and properties of said calendar. These can be found in

~/Library/Application Support/iCal/Sources/

Go through your folders, opening the Info.plist files, and look at the "Title" string to let you know which calendar is inside that particular folder. When you find the right one, the corestorage.ics in the same folder is the actual calendar file. Copy this to your desktop, or somewhere else convenient, so you don't accidentally mess up your calendar.

The rest is easy. Rename it to whatever you want (retaining the .ics file extension), and upload it to the location of your choice. People can now subscribe to it just as if you had used WebDAV within iCal.

How annoying though, right? You either have to look at the Info.plist files each time, remember the folder key, or use OS X's color labels to mark the right file. Even doing that, you're limited to seven unique colors, and you'd still have to remember which color is which calendar. If you're using 10.4.x, though, here's an opportunity to make use of Spotlight comments (Get Info on the file) and give it a descriptive name. Spotlight will now find the right one for you based on this new meta data. Sweet!

But it can be even easier. There's no need to find, copy, rename, and upload the calendar manually each time we make a change. Automator to the rescue!
  1. Start Automator, and using the method listed above, find the right corestorage.ics file. Drag it from your Finder window right into the Automator workspace. It will create a "Get Specified Finder Items" action with the appropriate file selected. You'll never have to remember it again.
  2. Select Finder from the Library, and drag a "Copy Finder Items" action to the workflow. Select a location from the dropdown menu. I use Desktop, because it's easy, and we're going to clean up after ourselves anyway.
  3. Still in the Finder library, drag a "Rename Finder Items" action to the workflow. Select "Replace Text" from the dropdown, and have it find "corestorage" and replace it with whatever descriptive name you want the calendar file to have.
  4. The next step is to upload the file. If you use Transmit, select it from the Library, and drag the "Upload Files" action to the workflow. If you use another FTP program, check with them for Automator actions. If you don't have a favorite, or yours doesn't have Automator actions, download the free Upload to FTP Automator action, and use it. Whatever the case, fill out the pertinent details for your server and desired location.
  5. Finally, in the Finder library, drag the action "Move to Trash" to the workflow, to clean up our temporary file that we copied in step two.
That's it! Save the workflow and keep it on your Desktop or Dock for quick one-click uploads to your calendar. One important point to note: changes to your iCal files are not written to the corestorage.ics file until you exit the application. For the unafraid that want to make sure they don't forget this, we'll add two steps to the Automator action.

Download this new action and place it in either ~/Library/Automator/ or /Library/Automator/. It's simply an AppleScript Action that I made in XCode that issues the command Tell Application "iCal" to Quit. You could even do it yourself with Script Editor and just add it as a script step, but this way, the action sits in the iCal library ready to go. Drag and drop this new action to the top of your workflow, before the "Get Specified Finder Items" action.

If you don't keep iCal open regularly, you're done. If you do like it to stay open, just add a step to the end of the workflow. In the Finder library, drag the "Launch Application" action to the bottom of the workflow, after the "Move to Trash" action. Select iCal from the dropdown list of applications, and voila!

[robg adds: This article was originally published (by djones) on this page; thanks for submitting it here for the macosxhints' database. I haven't tested this one...]
    •    
  • Currently 3.60 / 5
  You rated: 5 / 5 (5 votes cast)
 
[52,018 views]  

10.4: Use Automator to help publish iCal calendars | 15 comments | Create New Account
Click here to return to the '10.4: Use Automator to help publish iCal calendars' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use Automator to help publish iCal calendars
Authored by: houchin on Oct 24, '05 06:03:45AM
If you're webhost supports PHP, you can use phpicalendar (http://phpicalendar.net/) to simulate WebDAV access. It includes a php script that mimics the WebDAV response that iCal expects to get. I've used this on a couple different servers and it works great.

[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: Krook on Oct 24, '05 07:40:27AM
For that to work you unfortunately have to be able to turn off Safe Mode on the server.
If you - like me - don't have that option i recommend a site called http://www.icalx.com where you can publish your calendars to just like on a .mac account.
You can have both personal and public calendars.

If you have trouble remembering the address on the road you could just have a HTML redirects script on your own site (e.g. www.yoursite.com/calendar) that redirect you to your calendar on icalx.com

Just a bonus tip :o)

[ Reply to This | # ]
bonus bonus tip
Authored by: sjk on Oct 24, '05 11:10:46AM

Or even create an icalx subdomain within your domain (e.g. icalx.example.org) with a redirect to your icalx site calendar page. :-)



[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: Blittser on Oct 28, '05 03:12:58AM

Yea, iCalX already does this, and works quite well. Another site that does free WebDAV is sharemation.com, which I would use if iCalX didn't already work so well. Sharemation will allow calendar sharing, but not remote HTML calendar viewing. And the Sharemation trash needs to be manually emptied ocassionally too.



[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: balam on Oct 24, '05 03:38:49PM

what verstion of calendar you have , I have the lates and does not work



[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: njensen on Nov 02, '05 08:01:31AM
You can also try publishing to http://ifreebusy.com It not only hosts ical files, it will convert to/from freebusy format, so that you can share calendar information with users on MS Outlook.

[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: ptone on Oct 24, '05 08:59:34AM
This applescript shows you how to navigate iCal's plist file to get a list of calendars and their associated storage file. This was written to refresh a published calendar from a source file that may have been changed by another publisher on the website:

property icalSupportFolder : (path to home folder as string) & "Library:Application Support:iCal:"
property nodesPlist : icalSupportFolder & "nodes.plist"
property sources : {}
property passwds : {}

on getValue(akey, keys, values)
	if keys does not contain akey then return false
	repeat with i from 1 to count of keys
		if item i of keys = akey then return item i of values
	end repeat
	return false
end getValue

on getPW(source)
	log "PW routine"
	return my getValue(source, sources, passwds)
end getPW

--iCal should be closed to refresh
tell application "Finder"
	if name of every process contains "iCal" then
		tell application "iCal" to quit
	end if
end tell

tell application "System Events"
	--set nodesPlist to POSIX path of nodesPlist
	set calendarList to property list items of property list item "List" of contents of property list file nodesPlist
	set publishedCalendarList to {}
	--set publishedCalendarNames to {}
	repeat with i from 1 to count of calendarList
		set pubData to property list items of property list item "Publishers" of item i of calendarList
		if pubData ≠ {} then
			--set end of publishedCalendarList to i
			set end of publishedCalendarList to ((i as string) & " : " & value of property list item "PublishName" of item 1 of pubData)
		end if
	end repeat
	
	set chosenCalendars to choose from list publishedCalendarList with prompt "Choose calendars to refresh (hold CMD key for multiple)" with title "Published Calendars" with multiple selections allowed
	repeat with aChosenCalendar in chosenCalendars
		set calIndex to characters 1 thru 2 of aChosenCalendar as string as number
		set sourceItem to value of 
			property list item 1 of 
			property list item "Sources" of 
			property list item 1 of 
			property list item "Publishers" of (item calIndex of calendarList)
		set sourceURL to value of 
			property list item "UploadURL" of 
			property list item 1 of 
			property list item "Publishers" of (item calIndex of calendarList)
		
		set sourceFile to icalSupportFolder & "Sources:" & sourceItem & ".calendar:corestorage.ics" as alias
		
		
		(* --- URL Access scripting does not store pw in keychain
		tell application "URL Access Scripting"
			download sourceURL to sourceFile replacing yes with authentication
		end tell
		*)
		
		--using curl for download and storing pw
		if sourceURL contains "@" then --authentication steps
			set username to characters 8 thru ((offset of "@" in sourceURL) - 1) of sourceURL as string
			
			if sources contains sourceItem then
				set passwd to my getPW(sourceItem)
			else
				display dialog "Please enter your password" with title "Web Authentication" default answer "" buttons {"OK, Always", "OK, Once"} default button 1 with hidden answer
				set theResult to result
				set passwd to text returned of theResult
				if button returned of theResult = "OK, Always" then
					set end of sources to sourceItem
					set end of passwds to passwd
					
				end if
			end if
			set sourceFile to POSIX path of sourceFile
			set sourceFile to quoted form of sourceFile
			set userpass to username & ":" & passwd
			set sourceURL to "http://" & characters ((offset of "@" in sourceURL) + 1) thru -1 of sourceURL as string
			set shellcommand to "curl -u " & userpass & " " & sourceURL & " -o " & sourceFile
			do shell script shellcommand
		else
			--no auth needed
		end if
		
		
	end repeat
	tell application "iCal"
		reload calendars
		activate
	end tell
	
end tell


[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: seancorfield on Oct 26, '05 12:15:50PM

Another possibility is localhost WebDAV:

I enabled WebDAV on my localhost Apache install and told iCal to publish to that. Then I have a cron job that FTPs the file (which now has an obvious name!) to a remote server for sharing.

---
"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood



[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: revolution1965 on Dec 13, '05 04:34:59AM

I don't know if things have changed since this hint was published, but i'm using iCal 2.0.3 and I simply go to publish, type in my web site ftp address like ftp://ftp.mysite.com and type in my username and password and iCal publishes my Calendar... via ftp... No need for Automator?



[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: digitaltvguy on Jan 30, '06 05:01:00AM

Yeah, 2.03 does seem to publish via ftp now. This has happened in the past. Hopefully Apple leaves this support in :-)

---

-Chris



[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: catzforever on Apr 18, '06 11:13:23AM

Yes, I can publish directly via ftp from ical, but apparently can't subscribe to it afterwards using ical. Poitinng to the ics file on the server, I get this message when ical downloads the file:

Data downloaded from http://mydomain.org/ical/Test.ics is not valid.

Any idea why?



[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: sebrenner on Apr 20, '06 07:43:03AM

I have the same problem. When I logged into my server I noticed the .ics file that was published by ical is zero kb. I think iCal is publishing a blank file.

I am on my way to the Apple Genius bar to get a better answer.



[ Reply to This | # ]
Use Automator to help publish iCal calendars
Authored by: sebrenner on Apr 21, '06 05:40:31AM

I spent some time at the genius bar yesterday. None of the geniuses used the publish feature in iCal, but after some research they concluded FTP is NOT supported at this time.

The private server option is for a private webdav server.

I reported the success dialog that appears after "publishiing" to an ftp server as a bug.



[ Reply to This | # ]
10.4: Use Automator to help publish iCal calendars
Authored by: JazzDude on Jun 24, '07 03:18:29AM

Seems the FTP support in iCal is still broken in 10.4.10 (iCal 2.0.5). Apparently Leopard fixes this.
This Automator workflow works as advertised - almost. The "Move to Trash" part does not delete the renamed file, probably because the "Move to Trash" action needs a finder item as input and not text. Any ideas how to circumvent this?



[ Reply to This | # ]
10.4: Use Automator to help publish iCal calendars
Authored by: JazzDude on Jun 24, '07 03:31:49AM

I found it myself - you need to add another "Get specified Finder items" action - specifying your renamed .ics file - between the "Upload to FTP" and "Move to Trash" actions, respectively.



[ Reply to This | # ]