How can I select a layer using Appelscript?

Hi, huge fan of Acorn!

I’m trying to automate some social media posts setups, and I find I need the ability to select layer 1 or 2 in the current document. I’ve checked through the (helpful) examples but can’t find any way to do this, nor any workaround using a keyboard shortcut or menu. Can anyone help me out?

Option-Right/Left Bracket will select the next / previous layer, but it’ll rotate through the list if you’re already at the bottom.

There’s no public way to do this via AppleScript, but I’ll see if I can add it.

Thanks! I will test this out! The option brackets will be something I can automate at least.

Menu items for this would also be welcome!

A menu item is easy to add if it’s via a plugin:

How to install this plugin:
1) Choose Acorn's Help ▸ Open Acorn's App Support Folder menu item.
2) Place this script in the Plug-Ins folder (and make sure it ends with .js)
3) Restart Acorn. The plugin will now show up in the Filter menu.

// The selectLayer method on Document is a private API, and might change in the future, but it'll be around in Acorn 7 for a while.

function main(image, doc, layer) {
    var bottomLayer = doc.baseGroup().layers().firstObject()