How do I make Preview open in the center of the screen everytime
How to control where Preview opens PDF documents? Thanks.
iMac 27″, macOS 11.3
Apple Intelligence is now available on iPhone, iPad, and Mac!
How to control where Preview opens PDF documents? Thanks.
iMac 27″, macOS 11.3
Preview has no configuration to redefine its opening location. But you can encourage it to position to the center of your screen…
You can use the following AppleScript after Preview has been opened with a document to shift the Preview window to the center of your screen. Compile the AppleScript as an application and drop it in the Dock where you click once to reposition the Preview window.
-- Automatically determine screen size, and center Preview appplication screen in
-- center of display.
-- Influenced by: https://apple.stackexchange.com/questions/9632/center-window-on-screen
-- VikingOSX, 2020-02-11, Apple Support Communities, No Warranties implied or otherwise.
tell application "Preview" to activate
tell application "Finder" to set {sw, sh} to {item 3, item 4} of (bounds of window of desktop as list)
if application "Preview" is running then
# tell application "Finder" to set visible of process "Preview" to false
tell application "Preview"
tell its front window
set winsize to (bounds of it) as list
end tell
end tell
tell application "Finder" to set the position of application process "Preview"'s front window to {¬
round ((sw - ((item 3 of winsize) - (item 1 of winsize))) / 2) rounding as taught in school, ¬
round ((sh - ((item 4 of winsize) - (item 2 of winsize))) / 2) rounding as taught in school, ¬
round ((sw + ((item 3 of winsize) - (item 1 of winsize))) / 2) rounding as taught in school, ¬
round ((sh + ((item 4 of winsize) - (item 2 of winsize))) / 2) rounding as taught in school}
activate application "Preview"
end if
return
The first time you invoke the compiled AppleScript from the Dock, you will be greeted by no less than five security prompts in Big Sur (and probably Catalina too). This is a crock… and fortunately, it is once:
Click the OK button, open System Preferences, unlock the Security & Privacy panel, Accessibility will likely be selected, and you select the name of your compiled application (e.g. preview_move_window) to grant permission and click OK on the final dialog.
The next time you launch Preview, you can click on the application in the Dock and move the Preview window dead center screen.
Preview has no configuration to redefine its opening location. But you can encourage it to position to the center of your screen…
You can use the following AppleScript after Preview has been opened with a document to shift the Preview window to the center of your screen. Compile the AppleScript as an application and drop it in the Dock where you click once to reposition the Preview window.
-- Automatically determine screen size, and center Preview appplication screen in
-- center of display.
-- Influenced by: https://apple.stackexchange.com/questions/9632/center-window-on-screen
-- VikingOSX, 2020-02-11, Apple Support Communities, No Warranties implied or otherwise.
tell application "Preview" to activate
tell application "Finder" to set {sw, sh} to {item 3, item 4} of (bounds of window of desktop as list)
if application "Preview" is running then
# tell application "Finder" to set visible of process "Preview" to false
tell application "Preview"
tell its front window
set winsize to (bounds of it) as list
end tell
end tell
tell application "Finder" to set the position of application process "Preview"'s front window to {¬
round ((sw - ((item 3 of winsize) - (item 1 of winsize))) / 2) rounding as taught in school, ¬
round ((sh - ((item 4 of winsize) - (item 2 of winsize))) / 2) rounding as taught in school, ¬
round ((sw + ((item 3 of winsize) - (item 1 of winsize))) / 2) rounding as taught in school, ¬
round ((sh + ((item 4 of winsize) - (item 2 of winsize))) / 2) rounding as taught in school}
activate application "Preview"
end if
return
The first time you invoke the compiled AppleScript from the Dock, you will be greeted by no less than five security prompts in Big Sur (and probably Catalina too). This is a crock… and fortunately, it is once:
Click the OK button, open System Preferences, unlock the Security & Privacy panel, Accessibility will likely be selected, and you select the name of your compiled application (e.g. preview_move_window) to grant permission and click OK on the final dialog.
The next time you launch Preview, you can click on the application in the Dock and move the Preview window dead center screen.
FWIW, you can use a utility such as Magnet which will allows you to arrange apps from the menu bar, once the app is open, Including centering.
JohnnyDeLuxe wrote:
How to control where Preview opens PDF documents? Thanks.
You can't.
How do I make Preview open in the center of the screen everytime