Regarding AppleScript on and RSS Items

Remember when I figured out how to attach inline images to RSS items?

Well, today I tried to build a trivial little AppleScript to invoke my Python script straight from, based on the premise that the numeric part of the filename is actually unique on Mail’s filesystem tree and that it matches the message id that you can (quite trivially) obtain in a script such as:

tell application "Mail"
  -- grab the message ID
  set theSel to get selection
  repeat with theMsg in theSel
  	set theId to theMsg's message id
  	-- get Python to do the dirty work for us
  	set output to (do shell script "python ~/Scripts/ -i " & theId)
  	-- rest of AppleScript truncated for brevity
  end repeat
end tell

The idea would be that I could just invoke this from Mail Act-On and the RSS items would get properly archived.

Well, it turns out that RSS items are “special”, in the sense that AppleScript fails with Mail got an error: Can’t get account "RSS".

Why? Well, reading Script Editor’s Event Log, I get:

Which means that yes, AppleScript can get the actual numeric value, but apparently not assign it to anything because you’re supposed to get a complete reference (ID + mailbox + account), and AppleScript cannot resolve the account bit.

Since the above is a bit ambiguous, I also tried the following:

tell application "Mail"
  set theId to id of item 1 of (selection as list)
  set output to (do shell script "python ~/Scripts/ -i " & theId)
  -- etc.
end tell

Which fails in precisely the same fashion – i.e., it is unable to figure out what the “RSS” account is.

So I just filed #5874316. If anyone knows a decent workaround for this (other than copying the RSS items to a “normal” folder under a “normal” account, which I really don’t want to do), I’d appreciate it if you could drop me a line.