Created
October 28, 2009 01:58
-
-
Save rentzsch/220167 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Store Twitter Replies in Yojimbo.jstalk | |
// | |
// Usage: select a subscription in NetNewsWire that contains a bunch of twitter replies you'd like to archive | |
// (often lazytweet replies). This script will gather all *unread* "headlines" (sadly I can't seem to just | |
// access selected headlines) and push them into one new Yojimbo note (all hyperlinked and stuff). | |
var nnw = [SBApplication application:"NetNewsWire"], | |
headlines = [[nnw selectedSubscription] headlines], | |
headlineIndex = 0, | |
headlineCount = [headlines count], | |
output = '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body>\n', | |
headline, | |
outputFileURL = [NSURL fileURLWithPath:'/tmp/output.html' isDirectory:NO]; | |
for (; headlineIndex < headlineCount; headlineIndex++) { | |
headline = [headlines objectAtIndex:headlineIndex]; | |
if (![headline isRead]) { | |
output += '<p><a href="'+[headline URL]+'"><b>'+[headline creator]+':</b></a> '+[headline title]+'</p>\n'; | |
} | |
} | |
output += '</body></html>'; | |
output = [NSString stringWithString:output]; | |
[output writeToURL:outputFileURL atomically:YES encoding:NSUTF8StringEncoding error:nil]; | |
(function(){ | |
var yojimbo = [SBApplication application:"Yojimbo"]; | |
newNote = [yojimbo import:[NSArray arrayWithObject:outputFileURL]]; | |
[newNote setName:'twitter imported replies']; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment