Center Cursor Script?
So, we are running capture one on a MacBook Pro with three additional monitors for clients etc. It's easy for the cursor to get lost on the second 4k monitor (the cursor there is very small). Is there any way to set up a shortcut key or script to center the cursor on the primary screen?
-
Not a script, but I have a little utility designed specifically to do this: https://lostcause.photo/projects/capturecursor/
0 -
So, we are running capture one on a MacBook Pro with three additional monitors for clients etc. It's easy for the cursor
-2 -
I'd be interested to know if this script works for multiple monitors. Works on my single monitor. You'd probably want to set a shortcut to the script in System Preferences -> Keyboard -> Shortcuts -> App Shortcuts. I tested Ctrl-.
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Quartz"
my centreMouseMainDisplay()
on centreMouseMainDisplay()
set displayID to current application's CGMainDisplayID()
set screenWidth to current application's CGDisplayPixelsWide(displayID)
set screenHeight to current application's CGDisplayPixelsHigh(displayID)
set centreOfScreen to current application's CGPointMake(screenWidth / 2, screenHeight / 2)
current application's CGWarpMouseCursorPosition(centreOfScreen)
end centreMouseMainDisplay0 -
Compiled and run in Script Editor, it brings the mouse to center of the main monitor, even if the mouse (and the script window) is on the secondary monitor
0 -
Quentin - The script works for centering the cursor. The app I made from it is working but I'm having trouble connecting it to a keyboard shortcut. What am I missing? I'd like to use 'option + c'.
0 -
When exporting the App from Script Editor, I used 'Run Only' and 'Don't Code Sign'.
In System Preferences -> Keyboard -> Shortcuts -> App Shortcuts, I selected my App, and in 'Menu Title' I entered the same name as the App.
0 -
Ah, I think there is a problem with choosing Opt as the modifier key with these keyboard shortcuts. Not sure if it's a system-wide issue or just with CO. I do know that if you hold down Opt when selecting a script in the system Script menu (if that's enabled in Script Editor Preferences) that it opens the script for editing instead of running it. But this could be a red herring...) I'm on CO21 and Mojave but if I try to make a script shortcut for CO with the keystroke Opt-something, I get an error after a few seconds as if the script is expecting an extra argument from somewhere.
Also, I didn't bother exporting the script, just saved it as a compiled script, plain vanilla. Let's say for the purposes of the explanation below, its path is ~/Library/Scripts/Capture One Scripts/Centre Mouse.scpt. This Capture One Scripts folder is the one that serves your scripts up in the Scripts menu.
In System Preferences -> Keyboard -> Shortcuts -> App Shorcuts, it's important to enter the menu command in full for your app in the form [menu title]->[command]. The menu title is "Scripts" in the case of CO. So if you've saved your script in ~/Library/Scripts/... as above and updated your Scripts menu in CO the full menu command will be "Scripts->Centre Mouse" (without the quotes). Try mapping to Ctrl-C instead of Opt-C and see how you go.
0 -
And thanks Eric for the heads up!
0 -
That works great! Thank you. This will make my four-monitor workflow way way easier!
0 -
4! I can only dream. Glad we found your mouse.
0
Post is closed for comments.
Comments
10 comments