[Solved] Open Preview, Press Markup, Then Press a Button Flow?

Similar to Zabobon's thread:

Any tips on how to make Preview.app:

  1. Open selected image in Finder
  2. Activate Markup
  3. In markup toolbar, activate the Pen tool?

Calling AppleScript masters.

Thanks.

EDIT:

Answering myself, this worked:


found this thread in StackOverflow:

Script works in Catalina:

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.5
      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
2 Likes

Great solution. I confirmed it works.

Here is the macro file in case anyone is interested.

Preview: Open Selected File and Markup with Pen.kmmacros (2.9 KB)
image

2 Likes

This is great! I usually annotate images with my iPad.

I press the spacebar, and then I click on the Markup. After that I have my image on my iPad, ready to edit.

Is it possible to do that with a hotkey?