Paste Safari Link In MarsEdit

January 3rd, 2013

One of the MarsEdit features that people really like is the simplicity of pasting a URL link into a post. Just copy a URL from anywhere, then press Cmd-Shift-A to transform the selected text in MarsEdit into a link.

Today a MarsEdit customer wrote with a more specific request: he would like to easily insert links to whatever page he happens to have open in Safari, while also using the title of the page as the link text. This is the kind of specialized feature that is less likely to show up as a built-in feature of MarsEdit, because if I added all the specialized features that might be handy here and there, it would quickly become overwhelming. But it’s the kind of thing where I’m very grateful for MarsEdit’s scriptability. Within a few minutes, I was able to share with this customer a script that does just what he wanted.

Click to download: Paste Safari Link script.

If you want to attach a keyboard shortcut to the script, you could use FastScripts, or you can add the script to MarsEdit’s Scripts folder, and then assign a keyboard shortcut using System Preferences:

  1. From MarsEdit’s script menu, select “Open Scripts Folder”.
  2. Drag the “Paste Safari Link” script into the folder.
  3. Open System Preferences
  4. Navigate to Keyboard, Keyboard Shortcuts, and select Application Shortcuts.
  5. Add a new shortcut for MarsEdit, specifying “Paste Safari Link” as the menu title.

When invoked, the script will insert a link to the active Safari page’s URL, using the page’s title as the text of the link. If you want to use different text as the title of the link, the just type and select it in MarsEdit before invoking the script.

Toggle iTunes 11 MiniPlayer

November 29th, 2012

Today, Apple released iTunes 11, the anticipated update that has been due “sometime in November” since they announced it earlier this year. Judging from reactions on Twitter it’s having a mixed response: the new UI is, as expected, either refreshing or distressing depending on your particular attachment to the old look-and-feel, and the extent to which the new look speaks to you.

Folks who use FastScripts or another utility to script iTunes will be pleased to know that much of its scriptability is unchanged. I’m able to use my variety of scripts for playing and pausing, showing track information, etc., without any issue. But some subtle things have changed, including support for minimizing or maximizing the iTunes window. My friend Gabriel Roth framed the problem on Twitter:


I scratched my head about a proper workaround for this. Indeed, not only does the minimized property behave differently than documented in the scripting dictionary, the new “MiniPlayer” is an independent window from the main window. Although they seem to toggle between one another, you can actually select and make both visible from the “Window” menu in iTunes.

My first thought was to simply hide one window while making the other visible. This would be a fine solution except another bug in iTunes 11 apparently prevents the new MiniPlayer window from being exposed to the scripting object hierarchy.

So the compromise is to resort to UI scripting. By simulating the selection of iTunes’s own “Switch” menu item, we can rest assured that the toggle will happen as naturally as possible given the constraints we are facing.

Download the Toggle iTunes MiniPlayer script if you interested in hooking up a hotkey or otherwise automating display of the iTunes 11 MiniPlayer.

Update: Doug Adams (of Dougscripts.com fame) pointed out in the comments that my original solution was less ideal because scripters on non-English systems would need to open and modify the script to search for the correctly named item. I was able to update the script to search instead for the item by its keyboard shortcut alone. This should make the script more immediately useful to users of iTunes 11 regardless of the primary language they run their Mac with.

MarsEdit 3.5.8: Fix For Non-US Keyboard Layouts

November 9th, 2012

MarsEdit 3.5.8 is now available on the Mac App Store and directly from the Red Sweater Store. This is a free update for licensed MarsEdit customers.

After shipping MarsEdit 3.5.7 earlier today I discovered a major, crashing bug that affected only certain customers with non-US keyboard layouts including Spanish, French, and Swedish. I made changes affecting the handling of different keyboard layouts in 3.5.7, and neglected to test those changes with an extensive enough variety of keyboard layouts.

It always feels terrible to ship a serious, crashing bug. It’s even worse in the context of the Mac App Store where developers have no direct control over the approval and release of new versions of the software. After waiting 14 days for 3.5.7 to be approved, I was excited to release it as soon as it was ready. But once you approve an app for release in the Mac App Store, there’s no going back. I can’t “wind back the clock” to make 3.5.6 available again.

I decided to remove MarsEdit from sale on the App Store until Apple approves 3.5.8. Of course this means I will not be able to make any new sales until that time, but it also means I will avoid causing unnecessary grief for afflicted customers. When you remove an app from sale it also removes any updates that may be available, withholding them from existing customers. In this case, that is exactly what I want, or at least it’s as close to what I want as is possible.

Here’s hoping I didn’t screw anything else up today.

Update: After submitting the bug fix version to Apple earlier today and requesting an expedited review, I received a notice from Apple that they would try to expedite it to review within 1 or 2 business days. Luckily they ended up putting it into review and approving it tonight, so “everything is back to normal again. Phew.

MarsEdit 3.5.7: WordPress Post Statuses

November 9th, 2012

Update: Unfortunately a major crashing bug required an urgent fix and release of MarsEdit 3.5.8.

MarsEdit 3.5.7 is now available on the Mac App Store and directly from the Red Sweater Store. This is a free update for licensed MarsEdit customers.

This update includes long-awaited support for recognizing and setting the post statues “Private” and “Pending” on a WordPress blog. This is especially important because previous to 3.5.7, edits by MarsEdit to a private or pending post would cause WordPress to assume that the post should be changed to “Published” status, potentially revealing private information.

Apart from that there are a number of minor improvements and bug fixes including performance fixes for WordPress that should cause publishing and refreshing to be somewhat faster. Folks who use keyboard layouts with non-Roman characters will appreciate a fix to a bug that caused keyboard shortcuts to stop working when switched to e.g. a Thai or Greek layout.

Complete change list below:

MarsEdit 3.5.7

  • Improve performance when publishing to WordPress
  • Support for WordPress Private and Pending post statuses
  • Use Mac localized sorting for better organizing in posts lists
  • Fix behavior of formatting keyboard shortcuts in non-Roman keyboards
  • Fix a bug that caused dates to incorrectly display as e.g. “Tomorrow” when they should be “Today”
  • Fix handling of bookmarklet requests when the app is not yet launched
  • Fix a graphical glitch in the Media Browser introduced in 3.5.6
  • Avoid a crash with Tumblr when exceeding their daily photo posting limit