Hotkey to instantly switch between layouts (Win)

I have a couple of layouts I switch between regularly. I couldn’t find a way to switch between them with a simple keystroke combination, so I created an autohotkey script to do it. I’m not sure if people are interested in these, or if this is the right place to post this; my apologies if not.

If there’s a way to do this within Scrivener I’d be interested in knowing - I always prefer to stay within native applications where possible.

Thanks to Jerome’s reply to my original post, I’ve significantly streamlined the script and eliminated the need to use the Click command with specific screen locations. The script below uses Alt+1 to select the script who’s name begins with &A and the Alt+2 to select the script who’s name begins with &B. This can be extended to as many layouts as you want.

Here’s the new script:

!1:: ;use Alt 1 to open Layouts window and select layout who’s name begins with &A
{ Send, {AltDown}{w}{AltUp}{l}{A} ;open layouts dialog and select first layout in list
return
}

!2:: ;use Alt 2 to open Layouts window and select layout who’s name begins with &B
{ Send, {AltDown}{w}{AltUp}{l}{B} ;open layouts dialog and select first layout in list
return
}

There is not a way to do this with a single keystroke in Scrivener–you’d need to use the Alt accelerator keys and then arrow through the menu, or pop open the layout manager and click or arrow through that. Thank you for sharing your script!

[Moderator note: moved to the Tips & Tricks forum]

Hi Tom

To enhance the accelerator key approach suggested by MM, you can place an ampersand before a unique character in the layout name, or use ordinals:

&1. Narrow Layout
2. &Wide Layout

Thus your keyboard sequences in this unnatural example would be “Alt-W L 1” for the first layout, and “Alt-W L W” for the second. This accelerator technique can also reduce the screen location hardcoding within a script.

Rgds – Jerome

Jerome - thanks for the tip! I didn’t know that & would work that way within Scrivener. Reducing screen-specific commands is always helpful.

Tom