RSVP - Please Reply

Armin's Spot on the Web


Home

Impressum

My Code


What is a Weblog?

Pictures (.Mac)


NetNewsWire: More news, less junk. Faster

Discussion

Recent Discussion

Create New Topic


Cocoalicious Sample Scripts

The Cocoalicious Project now supports AppleScript. Here are some ideas and examples what you con do.

Accessing Posts

The post represents a posts in Cocoalicious. You can access post by number, or using a filter:

tell application "Cocoalicious"
	-- get first post
	get post 1
	
	-- filter by description
	get first post where description starts with "RSVP"
	
	-- filter by tags
	get every post where tag string contains "opensource"
	
	-- filter by date (timestamp)
	get every post where timestamp is greater than (current date) - 1 * days
end tell

Open in Script Editor

The post class has a few useful properties the most important are:

  • description: the name or title of the post
  • url: the url of the post, this usually starts with "http://"
  • extended: the extended description of the post
  • timestamp: the time and date of the post (a date record)
  • tag string: the tags of the post in a space-separated string

Note: in the current implementation you can read the properties but not set them.

Creating a New Post

tell application "Cocoalicious"
	make new post with properties {description:"RSVP", url:"http://rsvp.atsites.de/", tag string:"blog applescript"}
end tell

Open in Script Editor

Note: the result of make new post might not be really sensible. This is due to the nature of the del.icio.us backend. If you want to continue working with the post after creating it, search for the url afterwards.

set theNewPost to first post where url is theNewUrl

Deleting a post

Once you have found the post you want to remove simply use a delete command:

delete first post

Build an HTML List from Cocoalicious Posts

Now for a more complex example: this script will gather all the posts from the last 3 days and build an HTML list like this one from the data and put it in the clipbaord.

Open in Script Editor

Discuss

Google
WWW RSVP.atsites.de

This page was last updated: Monday, December 13, 2004 at 10:02:39 PM
Copyright 2010 RSVP - Please Reply
Mail me @ arminbatmacdotcom
Create your own Manila site in minutes. Everyone's doing it!