James' Ubiquitous Blog


Global shortcut to add a marker in Logic Pro X

UPDATE: I've just modified the scripts to check if Logic Pro X is the frontmost app. If Logic is in the background, the functionality is the same, but if is the frontmost application, it adds a marker without switching applications.`

I've been looking for a way to create a marker in Logic Pro X while podcasting without having Logic in the foreground at all times.

After a bit of tinkering, I settled on an AppleScript that does the trick. This AppleScript will activate Logic, simulate the key combination to create a marker (^K), pause for 1/2 a second (anything less and I've found it to only work some of the time), then switch back to the last application (⌘⇥).

This can be activated in any number of ways. For example:

  • If you own EventScripts (you really should), you can activate it from an iPhone or iPad on the same local network
  • If you're an Alfred fan, you can use this little workflow to trigger the marker creation by double tapping the Control (^) Key or activating Alfred and typing "mark". This can also be set to any key combination that you like.
  • If you want to get really crafty and activate it by double tapping any modifier key without tying it to Alfred, you could use the following template from my KeyRemap4Macbook private.xml file (More on KeyRemap here), and set the script to run from any other application that can launch scripts via keyboard shortcuts.

Hope someone out there finds some use out of this. If you've got any questions, feel free to shout out :D.


KeyRemap4Macbook & Alfred File Selection

I've really enjoyed the switch from LaunchBar to Alfred, right around the time that version 2 was released, bar one little niggle that I've encountered. I've dived head first into the Workflows Forum discovering neat and interesting ways of interacting with apps on my local Mac and even my Mac mini media server at home. One of the features that I haven't used extensively, that little niggle, is Alfred's File Selection.

Alfred's File Selection is comparable to LaunchBar's Instant Send, which I used avidly, and enables you to directly modify files by selecting them anywhere in the Finder and double tapping on one of the Mac's Modifier keys; I had it set up to use a double tap of the Command key. The downside of Alfred's File Selection is that it's only accessable using a standard keyboard shortcut rather than, in my opinion, the more accessable double Command tap.

Wanting to emulate LaunchBar's function, I set about trying to enable this functionality using my favourite keyboard hacking application, KeyRemap4Macbook (not just for Macbooks). This took a bit of time on my pBrt as I was trying to get through the documentation which is a bit over the place. Once I worked my way though the Examples & Basic Syntax documents, as well as trawling through the samples.xml file to find any mention of DoublePressModifier, a function which enables exactly what I'm after. I finally came up with the solution!

Just paste the following bit of code into your private.xml file, click the ReloadXML button, and select "Double Command to Alfred File Selection".

        <name>Double Command to Alfred File Selection</name>
        <appendix>(+ Home to beginning of line)</appendix>
            KeyCode::A, ModifierFlag::CONTROL_L | ModifierFlag::OPTION_L

This remap will still enable the ⌘ (Command) key to act as it normalLy would but when double tapped, KeyRemap4MacBook will send ^+⌥+A (Control + Option + A). Your private.xml file can be located in the Misc & Uninstall section of KeyRemap4MacBook

Screenshot 2013-07-03 10.57.35.png

If you'd like to modify this to use a different Modifier key, simply change all instances COMMAND_L to the desired Modifier key, or, if you have a different shortcut setup to activate File Selection, change the third KeyCode line to the currently active shortcut.


So thanks to twitter buddy @sayzlim who pointed out that Alfred can indeed use double taps as a way of activating functions, I now need to find another use for my KeyRemap4MacBook code. Oh well. Thanks mate :D

Screenshot 2013-07-03 16.41.38.png


Turning @ttscoff's Link Bundler into a PopClip extension

Building on Brett Terpstra's link bundling service for Bit.ly, I thought I'd turn it into a PopClip extension. All you need to do is follow Brett's instructions to install the service then install my PopClip extension and you should be good to go.

Here are his instructions


Installation and Configuration

The installation takes a bit of effort, but it’s not too bad.

You can install the Service by unzipping it and double-clicking the .workflow file. A dialog will pop up asking if you want to install it or open it in Automator. We want to open it in Automator first because we need to make a small edit.

Next, you need an API key.

1. Set up a bit.ly account if you don’t have one

2. Log in to your Bit.ly account

3. Go to http://dev.bitly.com/my_apps.html

4. Click “Manage my apps” and enter your password

5. Copy the Generic Access Token

6. Go back to the workflow open in Automator

7. Scroll down to the first “Run Shell Script” action

8. Find the line at the top that looks like:

bitly_key = ‘xxxxxxx’

9. Paste your key between the single quotes and save

10. Close the file, go back to where you opened it from and double click it again, this time choosing the “Install” option.

— http://brettterpstra.com/2013/03/16/a-link-bundler-service-for-bitly/

You can find my PopClip extension here


Permalinking With Squarespace a reply to @MacSparky

This is a very quick post in reply to MacSparky's (David Sparks) post about how he achieves the little infinity (∞) permalink at the bottom of his pages. While there is nothing wrong with the way that he does it, using a little TextExpander snippet, there is a much quicker way to do it. 

All you need to do is open up the Blog Settings of the page that you want to add it to. Click on the Advanced tab, scroll down to the bottom and add this bit of code

<center><a href="http://smithjw.me{permalink}"></a></center>

into the Post Blog Item Code Injection section.

The only downside of this is that it will appear at the bottom of every single post on that particular page rather than just for the externally linked pages.



Initiating Screen Sharing or Back to My Mac from the command line

Just some information on how to start a Screen Sharing or Back to My Mac (BTMM from now on) session from the command line.

To launch a Screen Sharing session from the terminal on your local network, simply type

    open vnc://ip.address.of.computer:5900(this is the default Screen Sharing port)

To launch into a BTMM session is a bit trickier. First we need to either find your iCloud Member number or the specific Macs BTMM IPv6 address.

To grab your iCloud member number, open your Terminal client of choice and type

    dns-sd -E

You'll get a readout like this

    Looking for recommended registration domains:
    DATE: ---Wed 01 Aug 2012---
    11:16:33.698  ...STARTING...
    Timestamp     Recommended Registration domain
    11:16:33.699  Added     (More)               local
    11:16:33.699  Added                          icloud.com
                                                 - > btmm
                                                 - - > members
                                                 - - - > 000000000 (This is your member number :D)

Then you can type the following into the command line to start the BTMM session

    open vnc://computername.membernumber.members.btmm.icloud.com1

Another way to launch a BTMM session is to use the unique IPv6 that is given to any Mac enabled with BTMM. So far, that only two places that I've been able to see this address is by opening up the new version of Apple Remote Desktop for Mountain Lion which now also shows your BTMM machines as well as Macs on the local network.


You can then copy the IPv6 address and add it into the open vnc:// command.

This address can also be found after initiating a BTMM session from the Finder, navigating to ~/Library/Application Support/Screen Sharing/, & opening the file relating to Whichever computer that you just BTMMed.

If using the IPv6 address, make sure you put it in square brackets. It won't work otherwise.

    open vnc://[IPv6 address of mac]

1. On a side note, as has been seen in many posts, you can also use this address to ssh into any of your Macs using the following command

    ssh -2 -6 username@computername.membernumber.members.btmm.icloud.com


Follow me on App.net