There is an auto-converter script out there that works pretty well. I needed to tweak some things a bit but it was pretty easy—much faster than doing it manually!
I’ll try it on your script when I get a few free minutes …
There is an auto-converter script out there that works pretty well. I needed to tweak some things a bit but it was pretty easy—much faster than doing it manually!
I’ll try it on your script when I get a few free minutes …
============== Additional Scripts to what I posted above =================
; Hotkeys to move and resize active window to each monitor.
; NOTE: Windows is not consistent in how it interprets monitor numbers so even though my Monitor 1 is shown as the center monitor in Windows Display Settings, in the code below I have to refer to it as Monitor 3. Likewise my righthand monitor is shown as Monitor 2 but I have to refer to it as Monitor 1. I’m guessing this has to do with which port the monitor is plugged into on my video card but I haven’t tested that out.
; NOTE: Some of these commands use the Click command to click at specific screen coordinates. You can use the Window Spy utility that comes with AutoHotkey to find these coordinates for your screen. If you right click on the AHK icon in the system tray you will see an option to open Window Spy.
+F24:: ; Universal to move active window to right side of Monitor 2 which is my left monitor, written by Claude
{
; Get the active window
activeWindow := WinExist(“A”)
; Get monitor information
MonitorGet(2, &Left, &Top, &Right, &Bottom)
; Calculate window dimensions
windowWidth := (Right - Left) / 2 ;set desired fraction of monitor width
windowHeight := Bottom - Top
; Move and resize the window
WinMove(Right - windowWidth, Top, windowWidth, windowHeight, activeWindow)
}
; Hotkey to move and resize active window to center of center monitor
!+F24:: ;Universal to move active window to center of center monitor from Claude
{
; Get the active window
activeWindow := WinExist(“A”)
; Get monitor information
MonitorGet(3, &Left, &Top, &Right, &Bottom)
; Calculate window dimensions
monitorWidth := Right - Left
monitorHeight := Bottom - Top
; Calculate window size (95% of monitor height)
windowHeight := monitorHeight * 0.95
windowWidth := monitorWidth * 0.5 ; Making width 50% of monitor width for better centering
; Calculate window position to center it
windowX := Left + (monitorWidth - windowWidth) / 2
windowY := Top + (monitorHeight - windowHeight) / 3 ;I divide by 3 here so the window doesn't go below the taskbar in the center monitor
; Move and resize the window
WinMove(windowX, windowY, windowWidth, windowHeight, activeWindow)
}
^!+F24:: ; Universal to move active window to left side of my right monitor
{
; Get the active window
activeWindow := WinExist(“A”)
; Get monitor information
MonitorGet(1, &Left, &Top, &Right, &Bottom)
; Calculate window dimensions
monitorWidth := Right - Left
monitorHeight := Bottom - Top
; Calculate window size (full height)
windowHeight := monitorHeight
windowWidth := monitorWidth / 2 ;set desired fraction of monitor width
; Position window on the left side of the monitor
windowX := Left
windowY := Top
; Move and resize the window
WinMove(windowX, windowY, windowWidth, windowHeight, activeWindow)
}
!F16:: ; Scrivener - use Alt+F16 to open a bookmark in a Quick Reference window, then display bookmarks in that QR window, move it to the left monitor, then close the Bookmarks window in the middle of Monitor 1.
{
MouseGetPos(&originalX, &originalY) ; First store the current mouse position
Click “3625 125” ;click on the Bookmarks icon in the upper right corner of the screen
Sleep 200
Click “3600 220 2” ;double click on the first file in the Bookmarks dialog
Sleep 500
Click “20 1320” ;Click on bookmarks icon in lower left corner of the QR pane to display bookarks in the QR window
Sleep 200
; Send the Shift+F24 hotkey to move the window to the left monitor
Send(“+{F24}”)
CoordMode(“Mouse”) ;this and the next line make the center monitor the active monitor
MonitorGet(3,&L,&T,&R,&B)
MouseMove originalX, originalY ; Move the mouse back to the original position
Click ;click to active the pane in which the mouse started at the original position
}
F17:: ; Scrivener use F17 to scroll to bottom of right hand Scrivener pane
{
Click “3485 1986 50” ;click on the bottom of the right hand vertical scroll bar 50 times
;Sleep 100
return
}
^F17:: ; Scrivener use Ctrl+F17 to scroll to bottom of left hand Scrivener pane
{
Click “1935 1986 50” ;click on the bottom of the left hand vertical scroll bar 50 times
;Sleep 100
return
}
+F17:: ; Scrivener use Shift+F17 to scroll to top of left hand Scrivener pane
{
Click “1935 205 50” ;click on the top of the left hand vertical scroll bar 50 times
;Sleep 100
return
}
!F17:: ; Scrivener use Alt+F17 to scroll to top of right hand Scrivener pane
{
Click “3485 205 50” ;click on the top of the right hand vertical scroll bar 50 times
;Sleep 100
return
}
#F14:: ;Scrivener: Use #F14 to activate Aeon Timeline and sync with Scrivener
{
if WinExist(“ahk_exe AeonTimeline.exe”)
{
WinActivate ; Use the window found by WinExist
Send “^!y” ;send the shortcut key Aeon uses for syncing
}
else
MsgBox “Aeon Timeline is not open”
}
!+F14:: ;Scrivener: use Alt+Shift+F14 to toggle backup on close
{
Send “^{,}” ;open Options dialog
Sleep 500
Click 1400, 70 ;open Backup tab
Sleep 200
Click 60, 300 ;check box for Back up on project close
Sleep 200
Send “{Enter}”
}
;Another way to scroll the currently active window
!F15:: ;Scrivener - Scroll Up
{
; Send a single “WheelUp”
Send “{WheelUp}”
}
^#F15:: ;Scrivener - Scroll Down
{
; Send a single “WheelDown” event
Send “{WheelDown}”
}
#HotIf WinActive(“ahk_exe AeonTimeline.exe”) ;only execute if Zotero is running
^F13:: ;Aeon - toggle Event pane
{
MouseGetPos(&startX, &startY) ; Capture the starting position of the mouse
Click 35, 375 ;click on Events icon
MouseMove startX, startY ; Move the mouse back to its original position
}
+F13:: ;Aeon - toggle Character pane
{
MouseGetPos(&startX, &startY) ; Capture the starting position of the mouse
Click 35, 435 ;click on Story Arcs icon
MouseMove startX, startY ; Move the mouse back to its original position
}
#F13:: ;Aeon - toggle Story Arc pane
{
MouseGetPos(&startX, &startY) ; Capture the starting position of the mouse
Click 35, 495 ;click on Story icon
MouseMove startX, startY ; Move the mouse back to its original position
}
F13:: ;Aeon - toggle Location pane
{
MouseGetPos(&startX, &startY) ; Capture the starting position of the mouse
Click 35, 615 ;click on Location icon
MouseMove startX, startY ; Move the mouse back to its original position
}
^+F13:: ;Aeon - toggle Filters pane
{
MouseGetPos(&startX, &startY) ; Capture the starting position of the mouse
Click 35, 275 ;click on Filters icon
MouseMove startX, startY ; Move the mouse back to its original position
}
^!F13:: ;Aeon - toggle Search pane
{
MouseGetPos(&startX, &startY) ; Capture the starting position of the mouse
Click 35, 215 ;click on Search icon
MouseMove startX, startY ; Move the mouse back to its original position
}
!F13:: ;Aeon - shift item date by x time period
{
Click 430, 30 ;Click on Item menu
Sleep 200
Click 470, 245 ;Click on Shift Items By
}
+!F13:: ;Aeon - open Options dialog
{
Click 570, 30 ;Click on Tools menu
Sleep 200
Click 570, 80 ;Click on Options…
}
+#F13:: ;Aeon - open Export as PDF dialog
{
Click 90, 30 ;Click on File menu
Sleep 200
MouseMove 100, 500
Sleep 200
Click 425, 560 ;Click on Options…
}
; — Hotkey Definition created by Gemini —
F15:: ;Aeon - Scroll Left
{
; Send a single “WheelUp” event with the Shift modifier held down.
Send “+{WheelUp}”
}
^F15:: ;Aeon - Scroll Right
{
; Send a single “WheelUp” event with the Shift modifier held down.
Send “+{WheelDown}”
}
#HotIf ;turn off application specificity
@SCN I just posted a bunch of additional scripts that will help with some of what you’re looking for. They should be a good starting point for setting up your screens.
Note that several of them use “Click xxx yyy” to click at specific screen coordinates so you’ll need to use Window Spy to find the coordinates for your setup.
I also use Aeon extensively and included a number of scripts I’ve written for that as well.
Good luck with them and let me know if you have questions.
These are really interesting, Tom. It’s great of you to share them. They’re giving me lots of ideas.
@JimRac I finally got around to testing your script—it’s really nice, I’m going to customize the menu and use it—it’s a nice addition to my Scrivener AHK scripts. Thanks!
I asked Claude to convert your two files into a single AHK V2 script and it did it flawlessly first time. Here’s the AHK V2 version of your scripts:
#SingleInstance
#Requires Autohotkey v2.0+ ;says that this script can only be executed by AHK v2.x
; AutoHotkey v2 Script - Scrivener Command Palette
; Converted from v1 to v2 and combined into single script
; v2 settings (replacements for v1 directives)
SendMode(“Input”)
SetWorkingDir(A_ScriptDir)
A_TitleMatchMode := 2
; Only active when Scrivener window is active
#HotIf WinActive(“ahk_class Qt643QWindowIcon”)
; F10 shows the command palette
F10:: {
ShowCommandPalette()
}
#HotIf ; End context-sensitive hotkeys
; Function to create and show the command palette
ShowCommandPalette() {
; Create the menu
PaletteMenu := Menu()
; Add menu items
PaletteMenu.Add("&Add to Collection", AddToColl)
PaletteMenu.Add("&Bullets", Bullets)
PaletteMenu.Add("&Color", Color)
PaletteMenu.Add("Complete Doc &Title", Title)
PaletteMenu.Add("C&opyHolder", CopyHolder)
PaletteMenu.Add("&Highlight", Highlight)
PaletteMenu.Add("&New from Template", NewFromTemplate)
PaletteMenu.Add("Outliner Selection A&ffects", Affects)
PaletteMenu.Add("&Para Spacing", ParaSpacing)
PaletteMenu.Add("&QuickRef", QuickRef)
PaletteMenu.Add("Re&veal in Binder", Reveal)
PaletteMenu.Add("&Revision Mode", Revision)
PaletteMenu.Add("&Swap Editors", Swap)
; Show the menu
PaletteMenu.Show()
}
; Menu action functions
Affects(*) {
Send(“!n”)
Send(“{Down 12}”)
Send(“{Enter}”)
}
AddToColl(*) {
Send(“!d”)
Send(“d”)
}
Bullets(*) {
Send(“!r”)
Send(“l”)
Send(“{Down 4}”)
Send(“{Enter}”)
}
Color(*) {
Send(“{AppsKey}”)
Send(“c”)
Send(“c”)
}
CopyHolder(*) {
Send(“!n”)
Send(“o”)
Send(“c”)
}
Highlight(*) {
Send(“{AppsKey}”)
Send(“h”)
}
NewFromTemplate(*) {
Send(“!p”)
Send(“w”)
}
ParaSpacing(*) {
Send(“!r”)
Send(“p”)
Send(“l”)
Send(“{Enter}”)
WinWait(“Line Spacing”, , 10)
WinActivate(“Line Spacing”)
Send(“{Enter}”)
}
QuickRef(*) {
Send(“!n”)
Send(“o”)
Send(“q”)
}
Reveal(*) {
Send(“!n”)
Send(“{Enter}”)
}
Revision(*) {
Send(“!r”)
Send(“r”)
Send(“f”)
}
Swap(*) {
Send(“!v”)
Send(“l”)
Send(“w”)
}
Title(*) {
Send(“!+=”)
ErrorLevel := KeyWait(“Tab”, “D T10”)
if (ErrorLevel) {
; Timeout occurred
return
} else {
; Tab was pressed within timeout
Send(“]]”)
}
}
Hey Tom, glad you like it, and thanks so much for sharing the converted code! That will really help me when I get around to learning AHK v2 myself.