Hi all,
I'm trying to use a single-key shortcut in Omnigraffle, but only run the command when I'm not typing inside a text field.
I got this:
tell application id "OGfl"
set lstSeln to selection of front window
set oShape to item 1 of lstSeln
tell canvas of front window
if value of attribute "AXFocused" of "AXTextArea" of oShape is 1 then
return "TRUE"
-- exit. do nothing, user is inside a text field.
else
return "FALSE"
-- ok, run command!
-- **command here**
end if
end tell
end tell
<AXApplication: “OmniGraffle”>
<AXWindow: “Untitled”>
Attributes:
AXFocused (W): “1”
AXChildrenInNavigationOrder: “<array of size 0>”
AXSelectedText (W): “”
AXInsertionPointLineNumber: “0”
AXPosition: “x=387 y=401”
AXNumberOfCharacters: “11”
AXSharedTextUIElements: “<array of size 1>”
AXSelectedTextRange (W): “pos=11 len=0”
AXHelp: “(null)”
AXChildren: “<array of size 0>”
AXRole: “AXTextArea”
AXParent: “”
AXTopLevelUIElement: “<AXWindow: “Untitled”>”
AXSharedCharacterRange: “pos=0 len=11”
AXSelectedTextRanges (W): “<array of size 1>”
AXVisibleCharacterRange (W): “pos=0 len=11”
AXValue (W): “hello world”
AXRoleDescription: “text entry area”
AXSize: “w=251 h=21”
AXWindow: “<AXWindow: “Untitled”>”
AXTextInputMarkedRange: “pos=11 len=0”
AXFrame: “x=387 y=401 w=251 h=21”
Actions:
AXShowMenu - show menu