I am trying to create a keyboard shortcut action for Preview, namely Draw and Sketch. However, they are are the NON-menued items, which means can't get it done in System Preference I see someone done it from inspiration, it is possible, but when I try to follow alone, here is my code so far and please help me complete this. here are the action.
Sketch. Draw
https://i.stack.imgur.com/wHwok.png
Here is the error I am facing now
System Events got an error: Can’t get radio group 1 of window 1 of application process "Preview". Invalid index.
https://i.stack.imgur.com/wz4U5.png
after some research
UI inspector
how can we take advantage of it?
how can we take advantage of it?
activate application "Preview"
delay 0.4
set the menuItem to "Draw"
tell application "System Events"
try
tell application process "Preview" to click radio button menuItem of radio group 1 of splitter group 1 of window 1
on error
try
tell application process "Preview" to click radio button menuItem of radio group 1 of window 1
on error errorM
display dialog errorM
end try
end try
end tell