Heya!
A scribbling fella just having fun with an xp-pen tablet
, Onto more tweaks!
Issue:
Using preview -> annotate
How to select these items? "Draw" "Sketch"
I found a macro similar to this one, therefore, I think we need applescript but unsure on how to target my pointed with pink 2 boxes within preview
Preview- Select Border Color (macOS 27).kmmacros (4.1 KB)
script from that macro
use scripting additions
tell application id "com.stairways.keyboardmaestro.engine"
set inst to system attribute "KMINSTANCE"
set btnIdx to (getvariable "local color_button_index" instance inst) as number
end tell
tell application "System Events"
tell application process "Preview"
set frontmost to true
tell first window
tell (first toolbar whose description is "toolbar")
if value of (first checkbox whose description is "Markup") is 0 then
tell (first checkbox whose description is "Markup")
perform action "AXPress"
end tell
end if
end tell
tell (first toolbar whose description is "edit toolbar")
tell (first color well whose description is "Border color")
perform action "AXPress"
tell first pop over
tell (UI element 2 whose description is "grid")
tell button btnIdx
-- perform action "AXPress" -- This fails here!
set btnPos to its position
my syntheticClick(item 1 of btnPos, item 2 of btnPos)
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell
on syntheticClick(x, y)
set swiftScript to "import CoreGraphics
" & ¬
"let down = CGEvent(mouseEventSource: nil, mouseType: .leftMouseDown, mouseCursorPosition: CGPoint(x: " & x & ", y: " & y & "), mouseButton: .left)
" & ¬
"let up = CGEvent(mouseEventSource: nil, mouseType: .leftMouseUp, mouseCursorPosition: CGPoint(x: " & x & ", y: " & y & "), mouseButton: .left)
" & ¬
"down?.post(tap: .cghidEventTap)
" & ¬
"usleep(30000)
" & ¬
"up?.post(tap: .cghidEventTap)"
do shell script "echo " & quoted form of swiftScript & " | swift -"
end syntheticClick
hmmm, idk why it is not picking up the colors for the code ![]()
image perhaps
Looks like is the place to change the code
Tell (first toolbar whose description is ...
also, what is AXPress, found a manual for applescript, just getting the handle of it ![]()


