2 posts tagged “script”
A week or so ago, the lovely people at Flickr launched their new iPhone-specific mobile site. It's very nicely done, and there's one thing in particular I noticed that I've always wished for on their main site.
Having had a (years-old) desire for this feature on the website rekindled, I decided to spend a few hours with Greasemonkey seeing if I could make it happen, and I managed to do so, thanks largely to people who've led the way. Here's show_flickr_contact_context.user.js.

However, before you go charging in to install it, I should probably warn you that it's very much still at the "proof of concept" stage. Flickr's context boxes are surprisingly complicated little blocks of HTML, and (perhaps ironically) I haven't made any of the JavaScript in them work. Moreover, it seems that I've broken the functionality in existing context blocks. Moreover, the script only works when you've come directly from the Photos from your Contacts page, or if it detects an argument that it sets in the URL from the context paging block.** This is because the API call the script needs to make seems to be quite a complicated one, so I'm trying very hard to be polite with the usage of it.
Anyway, I thought it'd be nice to document even though it's really only getting going, so feel free to have a play with it. If I do tidy up any of its rough edges, I'll be sure to mention it here.
* A couple of minor notes on the implementation. On the plus side, it obeys the setting on the Photos from your Contacts page that sets whether or not you see five or one image from each. However, there's no way to modify this on the phone itself. Unfortunately, it's also hard to change contexts; in other words, to swap from paging by contacts to paging within a user's photostream. Both compromises are down to the lack of space for UI on the iPhone, though, so I'm hardly going to really complain (hence the hiding this in a footnote).
** Ideally I'd do this using Flickr's own convention: /photos/name/id/in/contacts/. Unfortunately, if Flickr finds a /in/ argument it doesn't understand, you get redirected and lose the context, so I'm using /photos/name/id/?contact=in instead. Ah well.
I've never been one of the people who's seen a need to use any terminal application in Mac OS X other than the one supplied by Apple in Utilities. It does the job, uses Monaco 9, doesn't anti-alias (or at least, can be made not to). It starts up in Mac-ish black on white, and generally Just Works.
10.5 saw a bit of an overhaul, with a much saner configuration interface (all in Preferences, rather than hidden in a rather baffling out-of-the-way inspector) and tabbed browsing. Now, I still don't use tabs on the Mac OS, personally; I like the established app/window split and don't see the need to bring a third level of indirection into play, especially when it doesn't even have consistent shortcuts. (Tabs on Windows? Now that's a different story.) In fact, for years I'd quite happily got by with a bunch of scripts in ~/Library/Scripts/Applications/Terminal/ that would neatly stack all the windows.
Sadly, the new version of Terminal also introduced an annoying AppleScript bug which renders these scripts less than useful. When positioning a window, the vertical positions aren't honoured correctly: instead, the window ends up 320 pixels up the screen from the desired location - OK if you want a window at the top, but certainly not if it's meant to be at the bottom right, which is my usual position. I mention this now because the bug in Terminal that broke my window arrangers will also affect a script to centre windows that TALlama (no really) posted in response to a lazytwitter invocation by John Siracusa. If you try to centre a Terminal window, it ends up jammed at the top of the screen, for no apparent reason.
Now, I'm not down with the cool kids who post radr:// URLs, so if anyone who's reading this is, it's really easy to replicate the error: get a Terminal window towards the bottom of the screen, run this script - which should do nothing, as it's merely putting the window back where it started - and watch your window shift around. Do that, report it, and hopefully eventually I'll be able to retire my "set voffset to 320 -- work around AppleScript bug" line.
tell application "Terminal"
set b to bounds of window 1
set bounds of window 1 to b
end tell
Anyway, thanks for listening, and here's hoping for a better Terminal AppleScript interface in 10.5.3.