20140416

Maestro musings

Mac Power Users has sold me on Keyboard Maestro, and I've been playing with that a bit.

Today, I realized that some of my apps don't update automagically, so I set up scripts to automatically download and install the latest version once a week.

Basically, it's just a shell script that runs, but there are a couple interesting things in the shell script.

One of the apps is dropbox, which has a download link of https://www.dropbox.com/download?src=index&plat=mac

To save that string as a shell variable (so it can be referenced multiple times), I finally figured out that I need to do:
export URL='https://www.dropbox.com/download?src=index\\\&plat=mac'

The parts of note are the single quotes and the double-quoting of the ampersand (those three backslashes).  That enables doing
curl -s -e "$URL" ...
a bit later on.

The other interesting bit is very apple-specific.  That download gets a dmg, of course, which needs to be mounted.  What makes that tough is that there's a license agreement (GPL) to which agreement must be indicated.  Hence,
echo 'y' |hdiutil attach $ONAME -readonly >/dev/null

The utility 'yes' should work in place of 'echo y', but for some reason it wasn't (or at least it didn't appear to be.  It might be that another change in the command, or the line before it, was what got things working, rather than the change to echo).

Anyway, Keyboard Maestro is pretty cool.  I'm sure that I've only scratched the surface of what it can do, so far.

I actually got dropbox to facilitate syncing 1Password on my mac and my iOS devices, but haven't used it for that at all; I've been doing WiFi syncing (MPU did not sell me on 1Password; I've been using that for years.  But they might have gotten me to update to v4, and definitely did get me to get the iOS version).

No comments:

Post a Comment