Can I check if I am in a text field?

Possibily, but I'm such a UI novice that I can't offer any specific help, except for:

  1. Try various whose clauses, like
  • set kwField to first text field whose identifier is "keywordsEdit"
  • You might have to put this in a windows loop (see example script below)
  • Do you know the name/title of the window of this field?
    • if so, then use it.
  • For better help, you may want to post in:
    UI Browser Users Group - Yahoo Groups

Here is an example script for Outlook, where I am searching for the "subject" field in a compose window. It's kinda slow, but it works:

tell application "Microsoft Outlook" to activate

tell application "System Events"
  
  tell application process "Microsoft Outlook"
    set frontmost to true
    
    set winList to windows whose subrole is "AXStandardWindow"
    repeat with oWin in winList
      
      tell oWin
        
        --set index to 1
        --set focused to true
        perform action "AXRaise"
        
        try
          set subjElem to (first text field of splitter group 1 whose description is "Subject:")
          if (subjElem ≠ {}) then exit repeat
        end try
        
      end tell
      
    end repeat
    
    set subjProp to properties of subjElem
    set subjFocused to focused of subjElem
    
  end tell
end tell

return subjFocused

1 Like