June 2013

06/30/2013 19:30:22

How to set the table - Anna Post (by TEDEducation)

Finally explained.

06/28/2013 19:30:32

Unclutter, an unremarkable cloud syncing clipboard

Having something to sync text and files around from and to my various devices, that is a dream I have for a long time. First there was Pastebot. The next big thing was CloudClipboard, which I’ve been using since. It works really great, except that it depends on iCloud, which means that sometimes clipped content shows up immediately or maybe not.

Unclutter is a seemingly unremarkable app. It positions itself along the lines of Yoink and DragonDrop. The app is different in that it has three panes however. One to drop files into, a notes section and one that displays the current clipboard content.

Unclutter's three main panes

I should mention that Unclutter comes from the makers of DaisyDisk, so I should have know the app has more tricks up its sleeve. Unclutter has a preference setting that allows you to pick a folder where files and notes are stored.

File and notes settings

Now this is where things become interesting. As you can see in my screenshot I chose a different folder for notes and files, one that is inside Dropbox.

Unclutter’s files in Dropbox

When Unclutter is activated, it reads its notes file and displays the content, writing into the notes section and closing Unclutter causes the file to be saved. This way the notes are always in sync, transferring other files, such as images and PDf’s, is now seemingly easy.

On iOS, you ask? Nebulous allows instant syncing. You can also use my technique described here for leaving Evernote for Documents.

I have no idea, whether this was the original intention for the app, but it works really well. Unclutter is $4.99 on the Mac App Store.

<

p>

06/28/2013 15:40:35

jshmllr:

Happy Retirement Google Reader

06/28/2013 00:40:00

Convert OpenMeta to OS X Mavericks Tags With This Script

Personally I’m not a huge tag user, but if I decide to use something, I use it very mindfully. I decided to use tags for a very particular thing on my computer: invoices. Having seen tags being implemented by Apple now, made me very excited. It took only a Google search to find out that Apple chose to use xattr for their tag implementation[1]. I quickly wanted to have something to convert my OpenMeta tags over to OS X tags, so I cobbled together this script. You might want to first try this script with a test folder.

It is very limited and might not suit your own workflow. It is released under under Creative Commons ShareAlike. Feel free to contribute your modifications.

Note that your OpenMeta tags will stay intact.

Thanks to Stack Overflow, aforementioned Google discussion, and Mac OS X Hints this was not nearly as difficult as I first thought it would be.

Requirements

You need a working OpenMeta binary. You can download the latest from their Google project page. I chose to install mine under /usr/local/bin, if you decide to keep it somewhere else, change the script accordingly.

Secondly, you need to give this script a folder to work with. This is set in the $files variable. Please make sure NOT to type a trailing slash! This is very important. Otherwise your paths will look like this /Users/me/Desktop//example.pdf and this script will look very sad at you.

Third. I spent some time debugging this, but I only tested single-word tags and multi-word tags, which are surrounded by double quotes. If you know that your tags include some whacky characters like $, _, or !, this script might fail. Chances are it won’t. Just be aware of this sort of possible problem, which you might have to fix yourself.

Download

You can find this script on GitHub.


  1. The technical detail here is that OpenMeta tags are implemented the same way, except the extended attribute is very tiny bit different. OpenMeta tags are implemented as kMDItemOMUserTags, whereas OS X tags are _kMDItemUserTags. Use xattr -p com.apple.metadata:kMDItemOMUserTags YOURFILE.PDF | xxd -r -p | plutil -convert xml1 -o - - to get either OpenMeta or Mavericks tags in human readable format. (-w writes a plist)  ↩

06/24/2013 19:30:10

Drafts' "List To Reminders" on your Mac

One of the best things Drafts 3 (iPhone, iPad) implemented was the ability to talk to Reminders. Drafts comes with a nifty “List to Reminders” feature, which I use at least once a week to for my shopping list.

Since we don’t have Drafts on our Macs, I thought a more universal solution would be the best approach. Instead of taking text from a file, this script uses text lines from your clipboard.

It has the same feature that Drafts uses to put Reminders on a non-default Reminders list. Simply write an exclamation mark followed by the name of the Reminders list to use in the first line.

!Shoppinglist
Milk
Cottage Cheese
Lettuce
Tea
Vinegar

You can modify the script to close Reminders immediately afterwards, but since AppleScript has to open Reminders I thought it would be better to ask the user if Reminders should be closed again. The reasoning here is that Reminders would just pop up and immediately close, which feels a bit weird (like, “what just happened?”). So, the script asks to quit Reminders. The default is Yes.

(Gist version)

-- get clipboard and separate lines
set clipboardText to the clipboard as text
set reminderLines to paragraphs of clipboardText
set defaultRemindersList to "Shoppinglist"

-- figure out if a non-default reminder list should be used
if item 1 of reminderLines starts with "!" then
    -- set other reminder list and delete first line
   set remindersList to characters 2 thru -1 of item 1 of reminderLines as text
   set reminderLines to items 2 thru -1 of reminderLines
else
    set remindersList to defaultRemindersList
end if

tell application "Reminders"
   activate
   -- create reminders
    tell list remindersList
        repeat with currentReminderLine in reminderLines
           make new reminder with properties {name:currentReminderLine as text}
       end repeat
 end tell

end tell

-- optionally quit Reminders
tell application "System Events"
   activate
   set quitReminders to display dialog "Quit Reminders?" buttons {"No", "Yes"} default button "Yes"
   if button returned of quitReminders is equal to "Yes" then
     tell application "Reminders" to quit
   else if button returned of quitReminders is equal to "No" then
     -- if no is clicked, system events would still be active, so
       -- let's activate Reminders again
      tell application "Reminders" to activate
   end if

end tell

06/20/2013 19:30:00

Move Window to Screen Edges with Keyboard Maestro

Today I wanted to improve my Window Resizing macros with two macros. One that moves the frontmost window to the top left of the screen, and one that does the same except moving it to the top right. And because I was at it, I added bottom left and bottom right as well.

UPDATE 28. 06. 2013

There are now four new macros in this download. Move to top, bottom, left, and right center.

UPDATE 06. 09. 2013

The macros have been completely overhauled, i.e. the don’t use variables anymore, they use calculations only. (Yes, it took me that long to figure this out.)

Example Macro

Enjoy!

Download

https://www.box.com/s/pforggrdwlt0wk7flbz6

Also added to the GitHub repo.

06/19/2013 15:30:16

Save yourself some trouble and remap Mail's "Add Sender to Contacts" shortcut

There is a shortcut in Mail, in case you didn’t know, to “Add Sender to Contacts”. I just had the joy of pressing this shortcut ⇧⌘Y, while instead I was aiming for ⇧⌘U (“Mark As Read”). This was such a pleasant experience, because I happened to have all mails from Trash selected, which made Mail add 1230 contacts. Sadly not undoable. Why are these shortcuts so close to each other? Also why do the contacts not show up in Last Import in Contacts? *hrmpf*

Anyway. To remove all contacts create a new Smart Group:

Remove all contacts from there manually. Finally you may want to go to System Preferences and change that shortcut to something you will not press by accident:

Less learned, I guess.

06/14/2013 15:30:12

pdf2svg

We use a lot of different design apps in this company because our output varies so dramatically. We have the web (JPG, GIF, SVG), we have videos (PDF, JPG, TIFF), and we have written documents (JPG, TIFF, SVG, PDF). Our designer prefers to use InDesign. And while I’m not a personal fan of InDesign, I can see its benefits. So, I want her to use InDesign, but I also want a more “open” exchange file format. PDF is usually the best candidate, but when it comes to web SVG beats PDF, because it can be rendered natively in the browser.

What I normally get are .eps (Encapsulated PostScript), opening these in Preview converts them to PDF[1]. Converting them to something I could use for the web, turned out to be more of an undertaking. Luckily there’s pdf2svg, which converted everything to SVG.

I tried several other tools, but none of them left the paths in one particular document intact. pdf2svg was the only one which did. I can recommend it.

The reason I’m writing this here: I always have a Linux somewhere in a virtual machine for these purposes. If you look at the dependencies of pdf2svg in Homebrew (brew info pdf2svg) you can spot gtk+. If you ever compiled the GNU Toolkit by yourself you know that’s not going to happen on my machine anytime soon. Linux (Ubuntu) has GTK already installed, so getting pdf2svg up and running is much easier that way.


  1. Note that this is a low-tech setup. I could have her export all formats, but if she’s not in the office that doesn’t work so well.  ↩

06/11/2013 15:30:13

This is a small preview of km-markdown-library 2.

Progress is going pretty well so far. This video shows the Link New ability to fetch the title from a given URL. It’s not quite ready for public access, because there are some bugs in terms of deleting clipboard history, but if you are adventurous head over to GitHub and checkout the v2 branch.

Other changes:

06/09/2013 15:30:22

My Digital Stamp

via practicallyefficient

06/08/2013 15:30:19

Quartz Composer for iOS

Facebook recently got a lot of attention because they were using Quartz Composer to design Facebook Home.

Joris Kluivers published some really nice articles on Quartz Composer. Now he put his latest work out into the wild. Quartz Composer for iOS.

Read his blog post for the introduction.

06/07/2013 15:30:11

What the Internet is Doing to Our Brains

06/07/2013 15:00:17

Dispatch - Act on Emails Quickly

I’ve been reading about Dispatch on gridwriter’s blog. The app is made by the developers of Due (iOS, Mac and a friend of his, Hon Cheng, who have collaborated to form Clean Shaven Apps.

Dispatch is a first-glimpse action-based email client, like Triage, but it does a much better job. It has its own snippet system built in, but Clean Shaven promises to look into TextExpander next. Where Dispatch differentiates, is that it delivers a much more complete “act on emails quickly experience”.

Swipe across a mail and you get a couple of options. Similar apps only allow archive, maybe delete, but certainly not “this is junk”. Dispatch does all three. More clutter clearly, but also makes me feel much more relieved about emails.1

Second is it’s integration with third-party apps. Those “Triaging” actions include:

The long swipe (Quick Action) known from other apps can be customized to archive, spam, delete.

Dispatch is currently lacking, as said, TextExpander support. If they implement TextExpander, then please let it be TextExpander 2. There’s also no unified inbox. I complained via mail and they are working on it. An iPad version would be nice too, since I do most “email work” in the office on my iPad.

I really like Dispatch much better than Triage and feel like my $2.99 (50% off introduction price), are well invested.2


  1. I personally don’t use an archive. So I’m glad for an app that allows me to delete, rather than archive. 

  2. Yes, this article is shamelessly clustered with affiliate links. 

06/05/2013 15:30:30

jshmllr:

This wonderful artist creates paintings on the iPad. Check out her gallery.

06/04/2013 20:57:55

"Is Text Selected?" in AppleScript and Keyboard Maestro

Text selections in Keyboard Maestro or AppleScript are really a tough thing. Ever since I started writing my Markdown library I needed some way to figure out if there was text selected, and act accordingly. Scripts like “wrap text in …” or the Link macro wouldn’t be possible if I don’t know whether some text was selected already.
In the past I’ve settled with the basic approach of checking whether a certain menu item was enabled. Most (Cocoa) apps disable the Cut menu item if there is no text selected.

This has the downside that international users won’t be able to use these macros. Their menu entry for “Cut” might read “Ausschneiden” or “Couper”. I decided that this is still the best approach at the time.

Now that I’m rewriting my Markdown library for version 2, I want to tackle this problem again. Previously I was in the assumption that pressing ⌘C was no universal shortcut for all languages.

I looked up ways to check for text selections. Writing a System Service in Cocoa would have been an option. Making a Service in Automator, too.

Now, how would you call this Service from within AppleScript or Keyboard Maestro? A simple answer is you don’t. Keyboard Maestro can’t click an app’s menu. (That’s the menu where you find Preferences and the Services entry.) Something like this doesn’t work1:

We’re not going to give up here! Let’s write a little AppleScript that clicks the menubar for us. It can’t be that hard, can it?

-- put here your code to find frontmost app
-- here’s an AppleScript solution
-- http://macscripter.net/viewtopic.php?id=24540

tell application "Keyboard Maestro Engine"
    set frontApp to make variable with properties {name:"MMDFrontApp"}
    set frontAppName to value of frontApp
end tell

tell application frontAppName to activate
delay 0.3 -- wait for app to be frontmost
tell application "System Events"
    try
        click menu item "Get Selection" of ((process frontAppName)'s (menu bar 1)'s ¬
        (menu bar item frontAppName)'s (menu frontAppName)'s ¬
        (menu item "Services")'s (menu "Services"))
    on error errMsg
        display dialog errMsg
    end try
end tell

This code gets a variable MMDFrontApp from Keyboard Maestro and puts that app frontmost. It waits a little for things to catch up and then selects the apps’ menu, then it selects Services in that menu and then it selects “Get Selection” in that menu. Hor-ri-bly slow. No matter whether this code is compiled or doesn’t use variables (e.g. click menu item "Get Selection" of ((process TextEdit)’s (menu bar 1)'s), it will always take about 1 second to execute.
The second negative effect of this code is that it works most of the time. If everything is quick enough it works reliably. If things aren’t quick enough, well… it’s not working so great.
Adding delay’s would result in even slower code. No, thank you.

Then, yesterday, I was corrected by my assumption ⌘C wasn’t a universal, international, shortcut. It is! So hooray, right? Put the current clipboard contents away somewhere, set the clipboard contents to something predefined, ⌘C, and then check whether the clipboard is still set to whatever it was set to.

Or as AppleScript:

set currentClipboard to the clipboard
set the clipboard to ""

tell application "System Events" to keystroke "c" using {command down}

if the clipboard as string is "" then
    return "there was no text selected"
else
    return "there was text selected"
end if

set the clipboard to currentClipboard

I could have been just happy here, but I wasn’t. Quickly after I wrote this I realized why I didn’t like this approach about a year ago when I decided against it.
When this code executes and System Events presses ⌘C and there was no text selection the user will hear a short error beep, making them assume there was something wrong. From the script’s point of view though, there was just no selection.

The quick fix: in the short moment this script presses ⌘C, turn down the volume of all system errors and turn it back up when it finishes.

set currentVolume to alert volume of (get volume settings)
set volume alert volume 0

try
    tell application "System Events" to keystroke "c" using {command down}
on error errMsg
    return errMsg
end try

set volume alert volume currentVolume

Adding one little delay of 0.3 seconds makes sure that the system clipboard had enough time to put things on itself. The comparison works pretty well then. The only obvious downside2 is that other error sounds are also muted by this script.

This would be good enough, if only MacScripter wasn’t so helpful.

The following solution is fast and reliable. (as far as my first tests show)

set frontAppName to “TextEdit”

tell application "System Events"
    tell application process frontAppName
        set frontmost to true
        set selectionExists to (enabled of first menu item of (menu 1 of menu bar item 4 of menu bar 1) ¬
            where (value of attribute "AXMenuItemCmdChar" is "C") ¬
            and (value of attribute "AXMenuItemCmdModifiers" is 0))
    end tell
end tell

return selectionExists

No beeps with this version anymore. I was able to make this macro even faster, because the output is written directly to a variable. Working with the system clipboard (and its delays) is not required anymore. Now we can tell for sure that there was a text selection and press ⌘X.


  1. Peter, if you read this, that’s a feature request right there. 

  2. Another not so apparent problem is that ⌘C works on everything that is selected, not just text. If you are in Preview and have a rectangular selection there, this script assumes there’s a super snazzy text selection. 

06/04/2013 18:14:00

Byword 2 Adds Publishing to Tumblr

I was very surprised and happy to see an update for Byword in my App Store updates. Byword 2 keeps the writing experience minimal and improves some things with the way it renders fonts. The most important new feature though is Publishing.

With an In-App Purchase you can unlock publishing to the biggest blogging platforms such as WordPress and Tumblr.

Regarding Tumblr: I was suspicious whether Byword could publish to the queue or drafts, since almost no other “blogging” apps support this. Byword does! You can post to your queue so that articles get published automatically. Really cool.

The update is free for current customers. Publishing is an additional $5.

Byword for Mac

Byword for iPhone

Byword for iPad.