Clicking buttons in the "Preview" app

Hello everyone!

I need some help on selecting the "line" shape in the "Preview" app while editing.

I am able to click the "Shapes" button but has stuck on the next step.

activate application "Preview"

tell application "System Events"
	tell process "Preview"
		click button 3 of toolbar 2 of front window
		delay 0.5
		click UI element 1 of UI element 1 of pop over 1 of front window
	end tell
end tell

@ccstone

I actually confuse by what you post. The image indicates a Screen Capture window not Preview app, but the Applescript references the Preview app. If it is the Preview app, then you can actually use the default shortcut key.
image

1 Like

Hmmm, I have almost figured it out using UI scripting, but your solution solves the problem.

Thanks a lot :slight_smile: