Nearly every time I open Preview.app I will then immediately press the toolbox button and then the sketch button.
Is there a shortcut to access the sketch tool or some way to put the sketch button on my default toolbar?
Best Answer
This workaround applies to Preview.app 9.0 (909.12) in macOS Sierra 10.12.2 and will most likely break in future releases.
Launch AppleScript Editor and enter the following.
tell application "System Events" to tell process "Preview"
activate
set markup to checkbox 1 of toolbar 1 of window 1
tell markup
if not (its value as boolean) then
click markup
delay 0.1
end if
end tell
set sketch to checkbox 1 of toolbar 2 of window 1
tell sketch
if not (its value as boolean) then
click sketch
end if
end tell
end tell
Launch Preview, open a document, switch back to AppleScript Editor, and run your script. You will most likely get at least one error about AppleScript Editor requiring permission to use accessibility features.
Open System Preferences. Open the Security & Privacy pane. Click the Privacy tab. Click Accessibility. Click "Click the lock to make changes." Enter your password and click Unlock. Click the plus sign. Select Automator and click Open. Repeat, adding Script Editor. Make sure the checkboxes next to Automator and Script Editor are checked in the list.
(Hopefully, you'll only have to do step 3 once... until the next macOS upgrade.)
Go back to Script Editor, and try running your script again. Hopefully, in Preview, the Sketch tool will now be selected.
In Script Editor, save your script as an application somewhere in your home folder.
Find the application you just saved using Finder or Spotlight. Run the application. You will get another error about accessibility access.
Return to System Preferences > Security & Privacy > Privacy.
Click the little plus sign again. Browse to the application you just saved, and add it to the list. Make sure the check box next to it is checked.
Now, run your application from the Finder or Spotlight again. Hopefully you will not get an error this time.
Open Automator. Choose File > New. Choose Service. Under "Service receives selected," choose no input. Click any application and choose Other... Choose Preview.
In the "Actions" search box, type application. Drag Launch Application over to the "Drag actions or files here to build your workflow" panel.
Under Launch Application, choose Other..., then browse to your application.
Save the automator action (Service) with a sensible name, like "Preview Sketch Mode" or something easy to remember that you can type exactly.
Make sure the automator action works.
Launch System Preferences and go to Keyboard. Click Shortcuts. Click App Shortcuts. Click the plus sign. Under Application, choose Preview. Under Menu Title, type the exact name of the service name you saved in step 13 above. Assign a keyboard shortcut to it.
You should now have a keyboard shortcut that enables Sketch mode in Preview.
Have you looked under Preview preferences? You can set Initial Document Scale to 100% or larger if you want. You might need to adjust the option below that, defining size equal to screen or print sizes.
Use a better PDF viewer
If Preview.app can't do what you want, look into Skim.app
Skim has an option to open PDFs as Default, Maximized, or Fit. One of these ought to improve.
Customize Preview (complex)
If you want all three points requested above and want them in Preview.app, I would do the following:
Turn on Universal Access so you can script applications via the GUI
Make a new app in Automator that accepts PDFs. Replace Preview with this (open with this by default, put it in your dock so you can drag-and-drop onto it, etc.)
The new app should simply take the input PDF and pass it to Preview, so it displays there
The new app should then use Universal Access commands to
To make Preview open PDFs in the "Two Pages" mode, go to Preferences --> PDF, then select the desired mode in the "Show as" menu.
There is no shortcut to go to "Almost Fullscreen Mode" by default, but you can create one:
Go to System Preferences --> Keyboard --> Shortcuts;
Click "App Shortcuts";
Click the "+" button to add a new shortcut;
You'll be asked for the menu title you want to link to a shortcut. For the command you want, it is "Zoom";
You will also be able to specify whether you want the shortcut to be available in all application or a specific application only.
EDIT: Here's an AppleScript solution to set the first window of Preview (the frontmost opened document of Preview) to the size of the screen (works only with one display connected):
tell application "Preview"
tell application "Finder" to set screen_resolution to bounds of window of desktop
set bounds of window 1 to screen_resolution
end tell
Best Answer
This workaround applies to Preview.app 9.0 (909.12) in macOS Sierra 10.12.2 and will most likely break in future releases.
Launch AppleScript Editor and enter the following.
Launch Preview, open a document, switch back to AppleScript Editor, and run your script. You will most likely get at least one error about AppleScript Editor requiring permission to use accessibility features.
Open System Preferences. Open the Security & Privacy pane. Click the Privacy tab. Click Accessibility. Click "Click the lock to make changes." Enter your password and click Unlock. Click the plus sign. Select Automator and click Open. Repeat, adding Script Editor. Make sure the checkboxes next to Automator and Script Editor are checked in the list.
(Hopefully, you'll only have to do step 3 once... until the next macOS upgrade.)
Go back to Script Editor, and try running your script again. Hopefully, in Preview, the Sketch tool will now be selected.
In Script Editor, save your script as an application somewhere in your home folder.
Find the application you just saved using Finder or Spotlight. Run the application. You will get another error about accessibility access.
Return to System Preferences > Security & Privacy > Privacy.
Click the little plus sign again. Browse to the application you just saved, and add it to the list. Make sure the check box next to it is checked.
Now, run your application from the Finder or Spotlight again. Hopefully you will not get an error this time.
Open Automator. Choose File > New. Choose Service. Under "Service receives selected," choose no input. Click any application and choose Other... Choose Preview.
In the "Actions" search box, type application. Drag Launch Application over to the "Drag actions or files here to build your workflow" panel.
Under Launch Application, choose Other..., then browse to your application.
Save the automator action (Service) with a sensible name, like "Preview Sketch Mode" or something easy to remember that you can type exactly.
Make sure the automator action works.
Launch System Preferences and go to Keyboard. Click Shortcuts. Click App Shortcuts. Click the plus sign. Under Application, choose Preview. Under Menu Title, type the exact name of the service name you saved in step 13 above. Assign a keyboard shortcut to it.
You should now have a keyboard shortcut that enables Sketch mode in Preview.