objective c - Get NSTextFieldCell value using AppleScript -


i trying automate few tasks need text displayed on dialog box (the 6 digit code).

dialog box

accessibility inspector revealed following hierarchy:

accessibility inspector

i beginner in field of applescript , have read few examples similar done this:

set mytext textfield's stringvalue() text 

but i'm not sure if work in case, accessibility inspector not show variable names nstextfieldcell contains 6 digit code.

how can extract 6 digit code in nstextfieldcell , possibly return value shell script can use code?

i have right -

tell application "followupui"     activate     # 6 digit code end tell 

update

after help, have tried traverse text field

tell application "system events"      repeat theprocess in processes          #initialize         tell theprocess             set processname name             set allwindows windows         end tell          #check if process exists         if processname "followupui"              activate              "followupui found"              set windowscount count of allwindows              #only 1 window should exist             if windowscount 1                 "1 window found"                  tell window 1                     tell group 1                         tell text field 1                             set code value                         end tell                     end tell                 end tell              end if         end if     end repeat end tell 

but i've got stuck because of error -

system events got error: cant window 1. invalid index. 

i not sure if syntax error. pointers helpful. thanks

the error occurs because have reference window 1 of process "followupui"

your code complicated, need check if process exists

tell application "system events"     if exists process "followupui"         tell process "followupui"             tell window 1                 tell static text 1 of group 1                     set code value                 end tell             end tell         end tell     end if end tell 

if code part of workflow have wait until window open

tell application "system events"     repeat until exists window 1 of process "followupui"         delay 0.2     end repeat     tell window 1 of process "followupui"         tell static text 1 of group 1             set code value         end tell     end tell end tell 

i added its before value make sure refers current reference (the text field)

as don't send key or mouse events window don't need activate anything.


Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -