Please share your AutoHotKey macros for Scrivener

AutoHotKey: DownloadTutorialFAQReferenceSample Scripts

Please share any AutoHotKey (or PhraseExpress) scripts you are using in Scrivener.

SCRIVENER KEYBOARD SHORTCUT TIPS:
Customize Scrivener’s keyboard shortcuts via Tools>Options>Keyboard and use the “Edit Shortcut” line at the bottom of the window that pops up.
View, browse or print all keyboard shortcuts for Windows
Some regular shortcuts not working properly? Try deleting the [HKEY_CURRENT_USER]Software/Scrivener/Scrivener/Options/Shortcut key folder in Windows with the software closed and re-open. HT AmberV via this post

AUTOHOTKEY SCRIPTS:
[i]TIP: Turn off Windows “Sticky Keys” before using AutoHotKey[/i]
Open PDF at specific page in external viewer
Split a document and retain metadata, because for now, Scrivener’s built-in split function does not carrly the metadata to the newly split document.
Convert to uppercase or lowercase, by StefanG (I’ve PM’d StefanG for script details)

Hat Tip to narrsd and almansur for the idea of using Scrivener’s built-in duplicate function, and to AmberV for patiently and wisely contributing so much to my understanding of Scrivener

This is from Uku’s post here:

^!F5::
clipboard =
Send, ^c
ClipWait, 2
If ErrorLevel
{
MsgBox, Page number copy to clipboard failed
Return
}
FileDelete, c:\tempcmd.txt
FileAppend, c:\pdfxcview.exe /A "page=, c:\tempcmd.txt
FileAppend, %Clipboard%, c:\tempcmd.txt
FileAppend, " “C:\Dropbox\source.pdf”, c:\tempcmd.txt
FileRead, pdfcommand, c:\tempcmd.txt
Run %pdfcommand%
Return

Now I put the corresponding PDF page numbers into the Scrivener text wherever appropriate, and when I want to call the PDF, I mark the page number and then press Ctrl-Alt-F5: PDF is opened in PDF X-ChangeViewer at the correct page. I can also annotate and highlight the source PDF, as it stays in the Dropbox folder.

In order to split and retain metadata, I have mapped the Windows-z (hold down Windows key, press z) to split a document and retain the metadata using this AutoHotKey script, which only works when the AutoHotKey script is running and the Scrivener window is active:

SPLIT, ADD “.1” TO TITLE

#IfWinActive ahk_class QWidget
#z::
SendInput ^+{End}^x^+d{End}.1{Enter}^{Tab}^a^v
return


SPLIT, MAKE SELECTED TEXT TITLE

This requires you to select text in the created split document, which I’ll call the “child” document. After splitting, select the text and then use this script, which I have mapped to Windows-a (hold down Windows key, press a):

#IfWinActive ahk_class QWidget
#a::
SendInput ^c^{Tab}{F2}^v{Enter}^{Tab}{Right}{Left}
return

NOTE: If you change the initial ^c to ^x it will cut the text from the document before placing it as the title. In that case, remove the {Right}{Left} from the end, as they are superfluous.

Before beginning to use AutoHotKey, I suggest turning off “Sticky Keys” to avoid problems In Windows 7 (similar to Windows Vista).

Start from:
Control Panel\All Control Panel Items\Ease of Access Center\Make the keyboard easier to use
and under “Make it easier to type” uncheck box for “Turn on Sticky Keys…”
Then click link for “Set up Sticky Keys” and uncheck box for “Turn on Sticky Keys when SHIFT is pressed five times.”

These are fantastic, thanks for these! Do you mind if I move this over to the Tips and Tricks forum?

Great idea! Apologies for my carelessness in overlooking that more appropriate forum.

No worries! I’m going to have to check out AutoHotKey now, never played with it before.

If you want to browse the keyboard shortcuts, bookmark this page.

While you can print them from there, Scrivener will export a text file with all keyboard shortcuts in it if you go to Tools>Options>Keyboard within Scrivener, and near the bottom of the window that pops up, click Export and then choose “For printing” to get a file you can print from.

You can also view them from Tools>Options>Keyboard, but it’s not as easy as this page or printing them yourself.

Every time I open Scrivener I want my Keywords list to appear along the right edge of my monitor, stretched to almost the height of my monitor, and sorted. I wrote the following AHK script to do this; it uses Windows key + S to open Scrivener, switch to the keywords pane, open the keywords list, move it to the right edge of the screen near the top and resize it so the bottom of the keywords pane stretches to the bottom of the screen, click the Sort checkbox and sort the list. At the end it puts the cursor back in the upper left corner of the Editor window.

A few caveats: This uses screen coordinates relative to the Scrivener window, as well as absolute screen coordinates, so the values in the Click and WinMove commands may be different for different monitor sizes and resolutions, in which case you’ll have to use Window Spy (included with AHK) to determine the right values for your computer.

If anyone has questions or needs help getting this going, let me know.

#S:: ; use the Windows + S key combination to open scrivener, open the Keywords dialog, and position it stretched out on the right side of the screen
{ Run Scrivener ; start Scrivener
WinWait, Scrivener ; wait for Scrivener to load
Click 1169, 1120 ; Switch to the keywords pane
Click 1322, 449 ; click on the Keyword menu
Send {Down}{Down}{Down}{Enter} ; select the 3rd item on the menu - show Project keywords
Sleep, 333 ; pause so Windows can catch up
WinMove, Keywords, , 1640, 127, 272, 1008 ; move the Keywords pane to the right side of the screen and resize it
Click 1532, 1115 ; click the Sort checkbox
Click 91, 42 ; click the sort bar at the top of the dialog
Click -1152, 76 ; put the cursor at the top left of the editor pane
return
}

Here’s a simple script that pops up a dialog where you can type the name of a new item, then inserts that item as a child of the currently selected item in the browser. It uses the Ctrl+; key combination to trigger the script. Note that this is only useful if your cursor is at the bottom of a hierarchy in the browser. Note that if your on a folder, the Ctrl+N combo built in to Scrivener does already does this - it inserts a new child item under the folder your cursor is on. In that case, if you use this AHK script, it inserts the new item at the bottom of the lowest part of the hierarchy under that folder. This is a little hard to explain in words, but if you experiment with it you’ll see how it works. It’s a bit confusing because Ctrl+N functions differently in different contexts in the browser.

Let me know if you questions or need help with this.

#IfWinActive, ahk_class QWidget ; only execute if Scrivener is running
^;:: ; this script sets Control + ; to open a dialog where you type the document name, then hits Enter, then Ctrl+Right. In Scrivener this creates a new document indented to the right below the current document.
{InputBox, vfilename, Document Name ; set ctrl+; to pop up input box and get name of new file
Send ^n %vfilename% {Enter} ^{Right}
}

This macro puts a toolbar overlay on the Scrivener window, with buttons that run the alt-key combos for “Character Map” and “Reveal in Binder”. You’ll probably have to change the height, width and coordinates at Gui, Show. And you’ll want to be running Scriv in full screen, else this overlay will float out on its own.

I’ve got about a 5000-line script running in conjunction with Scrivener, and it all started with something simple like this.

Rgds – Jerome

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
FileEncoding, UTF-8
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
;
SetTitleMatchMode, 2 ; any match
WinGet ScrivName,ID,- Scrivener
;
Gui Scrivo:Default
Gui  -SysMenu -Caption
Gui  font, s8 bold, Verdana
Gui, Add, Button,x20 gCharMap, CharMap
Gui, Add, Button,ys gQReveal, Reveal in Binder
Gui +Owner%ScrivName%
Gui Color, e5e5e5, aaccaa
Gui, Show, h39 w300 x547 y46
Return
;
CharMap:
WinActivate, - Scrivener
Send !e
Send e
return
;
QReveal:
WinActivate, - Scrivener
Send !v 
Send r 
return

Rgds – Jerome

Jerome - this is great! Thanks for posting, it will save me considerable time.

Tom

Okay, it’s been nearly 6 years since this thread’s seen daylight. Time to bump it with a new AutoHotKey script. :smiley:

tl;dr:
This script enables ‘Freewrite Mode’, which will turn your feature-rich Scrivener software into a low-tech “distraction-free” editor that only supports backspace and a select few shortcuts.

Backstory:
The Astrohaus Freewrite is a $600 ‘smart’ typewriter with the following features: 10 line eInk screen, Cherry MX Brown mechanical keyboard, and cloud backups. It adopts an aggressively “distraction-free” “intended only for first drafts” “Hemingway mode” posture, in that the only editing capability it supports is the backspace key. The assumption is that you’ll use the Freewrite to bang out your first draft, and then use some other tool like Scrivener for subsequent drafts.

I have to admit, I’ve always been intrigued by the thing. I can see the use for it for someone like me. Once I get started, I can focus on a task for hours, but it’s the getting started part where I sometimes have to trick myself into cooperating with the flow. However, I couldn’t imagine trying to integrate yet another device into my workflow. Not to mention that price tag for a one-trick pony.

But–I’ve been learning AHK and looking for things to do with it, and the other day I realized–Hey! I already have a Cherry MX Brown mech keyboard, and cloud backups, and I can set Scriv Comp Mode to only view 10 lines–and dark mode is kinda like eInk, right?–so all I have to do to turn my $50 copy of Scrivener into a $600 Freewrite is disable a few keys with AHK!

The Script:
So that’s what this script does. All keys are disabled in Scrivener but the typing and backspace keys. Press F10 to toggle Freewrite Mode on and off.

If you prefer backspace disabled, simply tweak the two lines explicitly called out in the script. That will give you the full Hemingway “only move forward” treatment. :nerd_face:

Ctrl-S Save and Shift-F6 Sync with External folder are allowed, as backups are NEVER distractions. :sunglasses: I’ve also allowed myself Ctrl-U underline for emphasis. Feel free to enable or disable whatever you like.

Breaking this into two scripts greatly simplified the code. It also minimized interaction with Scrivener when Freewrite Mode is off, while maximizing disruption when Freewrite Mode is on. :metal:

Be sure to name the scripts as noted below–Freewrite Mode.ahk and Freewrite Mode_proc.ahk–and keep them both in the same folder. Launch script Freewrite Mode.ahk by hand or add a shortcut to it in your Windows Startup folder. That script does nothing but monitor for F10, so it won’t impact Scrivener.

How to use it:
Get Scrivener set up as you prefer for heads down drafting. (I like Comp Mode with a reduced vertical window.) Put the cursor in the Scrivener editor where you want to start writing. Press F10 and off you go.

This script disables keys and shortcuts when the Scrivener main window is the active window. To navigate to another program, use Win+Tab or Alt+Tab. Or just press F10 to turn Freewrite Mode off.

Note that you can navigate to Quick Ref panels, so if you’ve launched Quick Ref panels prior to pressing F10, you can view notes or research while the main editor is locked down.

Enjoy!


Freewrite Mode.ahk

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;--------------------------------------------------------------------------	

SetTitleMatchMode, 2

#IfWinActive, Scrivener

;--------------------------------------------------------------------------	

;	F10 engages Freewrite Mode
f10::

RunWait, Freewrite Mode_proc.ahk
return


Freewrite Mode_proc.ahk


;--------------------------------------------------------------------------	
; Auto-Execute section
;--------------------------------------------------------------------------	

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

SetTitleMatchMode, 2
SetStoreCapsLockMode, Off ; Necessary to allow capslock

#IfWinActive, Scrivener

;--------------------------------------------------------------------------	
; Progress bars use Scriv html Editor & Text colors
;	File > Options > Appearance > Main Editor > Colors
;
; Default        - Window color = CWffffff / Text Color = CT000000
; Dark Mode      - Window color = CW3f3f3f / Text Color = CTFFFFFF
; Mellow Yellow  - Window color = CW020202 / Text Color = CTffff00
; Solarized Dark - Window color = CW002c36 / Text Color = CTDEDEDE
; Midnight 	 - Window color = CW02141f / Text Color = CTffffff
;	Download Midnight here: https://forum.literatureandlatte.com/t/scrivener-3-1-accessibility/119430

CW_color := "CW02141f"
CT_color  := "CTffffff"

;--------------------------------------------------------------------------	

Progress, b2 fs16 zh0 %CW_color% %CT_color%, Freewrite Mode ON 
Sleep, 750
Progress, Off

;--------------------------------------------------------------------------	
; F10 disables Freewrite Mode
;--------------------------------------------------------------------------	

f10::

Progress, b2 fs16 zh0 %CW_color% %CT_color%, Freewrite Mode OFF 
Sleep, 750
Progress, Off
ExitApp

return

;--------------------------------------------------------------------------	
; Shortcuts to allow
;--------------------------------------------------------------------------	

$^u::Send ^u  ; Allow Ctrl-U underline (to disable underline, comment out this line)

$^s::Send ^s  ; Allow Ctrl-S manual save

$+f6::Send +{f6}  ; Allow Sync with External Folder Now

; Allow shift + letters
$+a::Send +a
$+b::Send +b
$+c::Send +c
$+d::Send +d
$+e::Send +e
$+f::Send +f
$+g::Send +g
$+h::Send +h
$+i::Send +i
$+j::Send +j
$+k::Send +k
$+l::Send +l
$+m::Send +m
$+n::Send +n
$+o::Send +o
$+p::Send +p
$+q::Send +q
$+r::Send +r
$+s::Send +s
$+t::Send +t
$+u::Send +u
$+v::Send +v
$+w::Send +w
$+x::Send +x
$+y::Send +y
$+z::Send +z

; Allow shift + symbols/numbers
$+-::Send +{-}
$+;::Send +{;}
$+/::Send +{/}
$+1::Send +1
$+2::Send +2
$+3::Send +3
$+4::Send +4
$+5::Send +5
$+6::Send +6
$+7::Send +7
$+8::Send +8
$+9::Send +9
$+0::Send +0

;--------------------------------------------------------------------------	
; Shortcuts to disable
;--------------------------------------------------------------------------	

$^Backspace::Send {Backspace} ; Allow backspace, but not Ctrl-backspace (To disable backspace, comment out this line) 

; Disable modifiers + letters
$*a::Send a
$*b::Send b
$*c::Send c
$*d::Send d
$*e::Send e
$*f::Send f
$*g::Send g
$*h::Send h
$*i::Send i
$*j::Send j
$*k::Send k
$*l::Send l
$*m::Send m
$*n::Send n
$*o::Send o
$*p::Send p
$*q::Send q
$*r::Send r
$*s::Send s
$*t::Send t
$*u::Send u
$*v::Send v
$*w::Send w
$*x::Send x
$*y::Send y
$*z::Send z

; Disable modifiers + symbols
$*'::Send {'}
$*-::Send {-}
$*"::Send {"}
$*(::Send {(}
$*)::Send {)}
$*,::Send {,}
$*/::Send {/}
$*;::Send {;}
$*[::Send {[}
$*\::Send {\}
$*]::Send {]}
$*^::Send {^}
; $*`::Send {`}
$*{::Send {{}
$*|::Send {|}
$*}::Send {}}
$*~::Send {~}
$*+::Send {+}
$*<::Send {<}
$*=::Send {=}
$*>::Send {>}

; Disable modifiers + numbers
; $*1::Send 1
$*2::Send 2
$*3::Send 3
$*4::Send 4
$*5::Send 5
$*6::Send 6
$*7::Send 7
$*8::Send 8
$*9::Send 9
$*0::Send 0

;--------------------------------------------------------------------------	
; Keys to disable
;--------------------------------------------------------------------------	

*Home::
*End::

*PgUp::
*PgDn::

*Up::
*Down::
*Left::
*Right::

*WheelDown::
*WheelUp::
*WheelLeft::
*WheelRight::

*LButton::
*RButton::
*XButton1::
*XButton2::

; *Backspace::  ;  To disable backspace, remove the comment on this line 
*Delete::
*Insert::

*Ctrl::
*LCtrl::
*RCtrl::

*Alt::
*LAlt::
*RAlt::

*AppsKey::

*Escape::

*f1::
*f2::
*f3::
*f4::
*f5::
*f6::
*f7::
*f8::
*f9::
*f10::
*f11::
*f12::
*f13::
*f14::
*f15::
*f16::
*f17::
*f18::
*f19::
*f20::
*f21::
*f22::
*f23::
*f24::

return
1 Like

@jwhitten created a script that assigns highlighter colors to hotkeys. Thanks John!

1 Like

My thanks to @JimRac for letting me know that there are discussions in the community here about using AutoHotkey to automate tasks in Scrivener. I only just discovered AutoHotkey, which I used to automate the Edit > Text Tidying > Remove Empty Lines Between Paragraphs function.

I wrote a script for AutoHotkey as a workaround because Scrivener for Windows does not work when using the keyboard shortcut for this function and does not allow us to assign it a shortcut. I solved the problem with my script and, to make it even more helpful, assigned the AutoHotkey to an Elgato Stream Deck button.

You can read the thread here: Navigating by keyboard to remove empty lines between paragraphs - Scrivener / Scrivener for Windows - Literature & Latte Forums.

1 Like

Here’s a sampling of scripts I’ve written in Autohotkey. All are set to run under AutoHotkey 2.x.

NOTES:

1) Almost all of my scripts are triggered through Streamdeck buttons. For those I use the extended Function keys (F13 through F24). This avoids potential collisions with an application’s built-in keyboard shortcuts. I like to keep my applications’ shortcut keys unchanged so if I ever lose my configuration I don’t have to go in and redo all of my changes. I do all of my shortcuts through AutoHotkey.

For scripts not running through a Streamdeck button I use keyboard shortcuts.

2) I always put the following at the top of the file that contains my scripts:

#Requires Autohotkey v2.0+ ;says that this script can only be execud by AHK v2.x
SetTitleMatchMode 2 ; goes before +Escape because that stops autoexecute section
SendMode “Input”
#SingleInstance Force ; this eliminates the “there is an older instance …” message box popping up when running it again
TraySetIcon “D:\OneDrive\My Icons\Scrivener icon 2.jpg”

;everything above this is the Autoexecute section. This is not necessary because the +Escape would automatically end the AutoExecute section, but this makes it clear that it ends here.

; Use Shift+Esc as a Kill Switch, in case a script needs to be interrupted. This will terminate this entire script file.
+Escape::ExitApp

#HotIf WinActive(“ahk_exe scrivener.exe”) ; only activate the following scripts if Scrivener is active

Scripts using keyboard shortcuts rather than extended function keys—these are scripts i execute from the keyboard directly:

^+h:: ;this simply highlights the cursor position momentarily—use control shift a to highlight the text around to the cursor, pause, then deselect it; useful in applications where you might have trouble visually finding the cursor
{
Send “{Left}” ; move to left to include one character there, in case I’m at the end of a paragraph where it will otherwise be hard to see
Sleep 300
Send “^+{Right 2}” ; highlight whatever is to the right of the cursor
Sleep 600 ; pause for specified number of milliseconds to allow me to see where the cursor is
Send “{Left}{Right}” ; stop highlighting and return the cursor to where it was
}

^;:: ; this script sets Control + ; to open a dialog where you type the document name, then hits Enter, then Ctrl+Right. In Scrivener this creates a new document indented to the right below the current document.
{
vfilename := InputBox(“Document Name”, “Enter the name of the new document”, “w400 h125”) ; set ctrl+; to pop up input box and get name of new file
Send “^n”
Sleep 200
Send vfilename.value “{Enter}”
Sleep 200
Send “^{Right}”
}

^+;:: ; this script sets Control + Shift + ; to open a dialog where you type the document name, then hits Enter, then Ctrl+Left. In Scrivener this creates a new document outdented to the left below the current document.
{
vfilename := InputBox(“Document Name”, “Enter the name of the new document”, “w400 h125”) ; set ctrl+; to pop up input box and get name of new file
Send “^n”
Sleep 200
Send vfilename.value “{Enter}”
Sleep 200
Send “^{Left}”
;Send ^{Tab}
}

Scripts using extended function keys that are triggered through Streamdeck buttons:

The following two scripts open layouts I have saved in Scrivener. These two layouts appear at the bottom of the Layouts menu so “Up 1” and “Up 2” select them.

+#F13:: ; Scrivener use Shift+Win+F13 to open Layouts window and select Single pane binder inspector bookmarks
{ Send “!{w}”
Sleep 200
;Send “{AltUp}”
Send “{l}” ;open layouts dialog
Sleep 200
Send “{Up 2}”
Sleep 200
Send “{Enter}”
}

+!#F13:: ; Scrivener use Shift+Exclamation+Win to open Layouts window and select Double pane binder inspector bookmarks
{ Send “!{w}”
Sleep 200
Send “{l}” ;open layouts dialog
Sleep 200
Send “{Up 1}”
Sleep 200
Send “{Enter}”
}

^!F13:: ; Scrivener use Ctrl+Shift+F13 to swap editors
{
Send “{AltDown}{v}” ;open View menu
Sleep 200
Send “{AltUp}”
Send “{l}” ;open layouts dialog
Send “{w}” ;swap editors
}

!#F13:: ;Scrivener: Alt+Win+F13 to open Quick Search
{
Send “!e” ;open Edit menu
Sleep 200
Send “f” ;select Find
Sleep 200
Send “q” ;Select Quick Search
}

F18:: ; Scrivener Open the 1st bookmark in the bookmarks list (most likely Scratchpad 1) in QR window are listed near the top of the Nav / Go To menu
{
Send “!{n}” ;open Navigation menu
;Sleep 200
Send “{r}” ;Go to Open Quick Reference menu
Sleep 200
;Send “{Down 1}” ;select 1st bookmark
Send “{Enter}”
}

F13:: { ;Scrivener - use F13 to display Bookmarks in Inspector
Send “!{n}” ;open Navigation menu
Sleep 100
Send “{p}” ;select Inspect
Sleep 100
Send “{b}” ;select Bookmarks
}

^F13:: { ;Scrivener - use Ctrl + F13 to display Snapshots in Inspector
Send “!{n}” ;open Navigation menu
Sleep 100
Send “{p}” ;select Inspect
Sleep 100
Send “{p}” ;select Snapshots
}

^+!F13:: { ;Scrivener - use Ctrl+Shift+Alt+F13 to display Synopsis in Inspector
Send “!{n}” ;open Navigation menu
Sleep 100
Send “{p}” ;select Inspect
Sleep 100
Send “{s}” ;select Synopsis
}

^!#F13:: { ;Scrivener - use Ctrl+Alt+Win+F13 to display Custom Metadata in Inspector
Send “!{n}” ;open Navigation menu
Sleep 100
Send “{p}” ;select Inspect
Sleep 100
Send “{m}” ;select Custom Metadata
}

^+F13:: { ;Scrivener - use Ctrl+Shift+F13 to take a snapshot of the current document
Send “!{d}” ;open Documents menu
Sleep 100
Send “{s}” ;select Snapshots
Sleep 100
Send “{s}” ;select Take Snapshot
}

!F13:: { ;Scrivener - Alt+F13 to Reveal in Binder
Send “!n” ;Open Navigate menu
Sleep 100
Send “{Enter}”
}

!+F13:: { ;Scrivener - Toggle Search or go to Search field
Click 220, 75
}

#F13:: { ;Scrivener - Open as quick reference
Send “!n” ;open Navigate menu
Sleep 100
Send “o” ;select Open
Sleep 100
Send “q” ;select Quick Reference
}

#+F13:: { ;Scrivener - open Add to Collection menu
Send “!{d}”
Sleep 100
Send “{d}”
}

!#+F13:: ; Use Alt+Shift+F13 to send Enter then add a solid line separator
{
Send “{Enter}”
Sleep 200
Send “_______________________________”
Send “{Enter}”
}

^+F13:: ;Scrivener: use Ctrl + Shift + F13 to open the document under the cursor in the binder in a quick reference window
{
Send “!+l” ;turn on Lock in place so the current editor doesn’t change to the file selected in the binder
Click “Right” ;open right click menu for item selected in binder
Sleep 400
Send “{o}” ;select ‘Open’
Sleep 400
Send “{q}” ;select ‘Quick Reference’
Sleep 400
Send “!{Tab}” ;return to active editor before turning off Lock in Place
Sleep 400
Send “!+l” ;turn off Lock in place so the current editor again changes to the file selected in the binder
Sleep 200
Send “!{Tab}” ; bring up the Quick Reference window that just opened
}

^+F16:: { ;Scrivener - use Ctrl+Shift+F16 to take a snapshot of the current document
Send “!{d}” ;open Documents menu
Sleep 100
Send “{s}” ;select Snapshots
Sleep 100
Send “{s}” ;select Take Snapshot
}

2 Likes

@TomGoodell , thanks for all the scripts, some good stuff !

Instead of shortcuts, I created an AHK palette for frequently used commands. I posted it here.

3 Likes

@JimRac thanks for that link! I haven’t worked with menus in AHK because I use Streamdecks so extensively. One of the things I like about Streamdecks is that it gets my hand and arm moving in a different way from mouse and keyboard movements. But I can see where menus could be a preferred method for some of the commonly used commands. I’m going to move it into my AHK Scrivener library and try it out in the next couple of days.

Quick question: is it AHK 2.x compatible?

@TomGoodell I enjoyed looking over your scripts. You’ve given me new ideas for using AHK.

Thus far, I haven’t made much use of AHK. Rather, I’ve mostly used Stream Deck functions to give me a button to activate keyboard shortcuts that I tend to use repeatedly, as shown here:

The one AHK script I created was as a workaround to an issue with Scrivener where I couldn’t navigate to a keyboard shortcut other than using the arrow keys (I linked to a discussion on my script earlier in this discussion). This was my first and, so far, only dive into AHK.

I understand from another thread that you use AHK to position Scrivener across three monitors (do I have that right?). It would be interesting to see your AHK script for this. I use the Stream Deck multi-action function to launch Scrivener and Aeon Timeline in assigned positions on my ultrawide monitor, which I discuss in this thread: One button to rule them all.

It automatically launches and positions Scrivener and Aeon Timeline like this (Scrivener is to the left, Aeon Timeline to the right):

I also have a similar multi-action function to reposition the apps in case I’ve moved them around for some reason and want them back into their default position.

Great question, Tom.

I haven’t tried AHK v2 yet, but I doubt my script (or any v1 script) is v2 compatible without some tweaking. :frowning:

But that’s just my assumption, based on the little bit I’ve read about v2. Converting my v1 scripts to v2 has been on my To Do list for a while now–some other project always seems to get in the way. :grin: