Capture One shortcuts for the terminally curious: part 3 (Final)

We have arrived at the final part of this series: the script!

This is a simplified extract of the full installer application I made, as it is simply far too big to break down into a single tutorial. Instead, I have made a fully functional version of the useful part, which does most of the heavy lifting and annoying bit – adding the shortcuts to a set of installed scripts.


  • Quit C1.
  • Make a folder in ~/Library/Scripts/Capture One/Scripts/
    • (For my example today: ~/Library/Scripts/Capture One/Scripts/Apply Latitude)
  • Copy your scripts into this folder – for this, I am using scripts from another project post to come in the new year – yours will be whatever you make.

My scripts are called:

  • “Apply SB-01.scpt”
  • “Apply SB-02.scpt”
  • “Apply SB-03.scpt”
  • “Apply SB-04.scpt”
  • “Apply SB-05.scpt”
  • “Apply SB-06.scpt”
  • “Apply SB-07.scpt”
  • “Apply SB-08.scpt”
  • “Remove Style.scpt”

You need to decide what the shortcuts will be, and you need as many shortcuts as there are scripts (9).

Next we need to map these together as a “value pair” for the script.

As a reminder on the first post in the series, coding shortcuts requires a bit of symbology to equate user facing stuff: Modifier keys are represented as: @ for Command, $ for Shift, ~ for ⌥ and ^ for ⌃.

So the string “@$~^t” represents ⌘+⇧+⌥+⌃+T

Im going to set these up as the full ⌘+⇧+⌥+⌃ + [key]. This is obviously impractical for a users, but it serves as a technical demonstration (and actually doesn’t matter in the other project). You might decide to use something else:

  • “@$~^A”
  • “@$~^B”
  • “@$~^C”
  • “@$~^D”
  • “@$~^E”
  • “@$~^F”
  • “@$~^G”
  • “@$~^H”
  • “@$~^I”

Now you have the list of file names, and the list of shortcuts, we have to combine this into an object the script will parse into the shell command.

The simplest way (IMO) to do this (and there are many methods) is to make a list. As we have to make many value pairs, we could go one step further and make a list containing the smaller lists.

A list in apple script is defined with curly brackets:

To define the first value pair, combine the script name and the shortcut (“” makes them text values) and then split with a comma.

We could add more pairs to a single list, but this would be suboptimal. Instead we create a list of lists (a list containing several smaller lists) by puting the another pair of brackets around the first. This gives you a main list, containing each of the value pairs as addressable items within it.

When completed, it should look like this:

Which is basically a list containing a number of text value pairs, each as their own little lists of 2 items.

TIP: You can line break long lines of code by placing the cursor and using ⌥+[return] – this makes reading and editing long lines easier.

When testing, you can now ask for a value pair from the list easily:

Which returns the 3rd item – {"Apply SB-03", "@$~^C"}

The script also needs to know the name of the folder you made your scripts in (seeing as we are using the full path approach to the shortcuts).

Create a new variable and assign the name:

Next we have to make some logic that will chop the value pairs for each row, and then run the shell command with those bits. A repeat loop can be used to cycle through the list, and extract the name and the shortcut from each pair by creating new varibles from the indexed position. Comments have been added to the code below explaingin each line (those lines starting –)

There are again, a few ways to do this. I used this approach:

The last part is the shell command, and is fairly advanced if you have no experince in scripting shell in AppleScript, requiring skills like string concatination, charcter escaping… and massive patience. I do conceed, I should maybe have started this this blog with a gentler slope, but what can you do. Stuff tumbles out when it does.

The shell command from part 2 was:

You can type this into terminal and it will work – but it wont if run from within AppleScript.

Shell commands from an AppleScript are invoked from the “Do shell script” command – this recieves a single text paramater between “”. Because our command has several ” between the first and last ” the script interprets the code inncorrectly. To stop this from happening we need to escape certain characters so the script ignores them, but will still pass them to the command line. To do this, charcters we want, but want AppleScript to interpret as just text, are proceeded with “\”.

We also – and at the same time (bloody hell) – have to inject our variables into the text. This requires replaceing stanadrd text with the varibles and then concatenation of the various elements together with “&”.

So with all 3 variables, escaping and the new command, our script looks like this:

Our script is now complete. Running the script will add the shortcuts to (in this case) Capture One 20.

The script from this post is below in full, if you want to copy paste this to your own IDE and start breaking stuff, go nuts.

If you screw up your C1 plist you can reset the custom shortcuts entry by using the following terminal command:

I hope this has been an interesting series – we have tonnes lined up, but I wonder what should be next?

Leave a comment after the break.


Leave a Reply

%d bloggers like this: