Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8582731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T21:21:54+00:00 2026-06-11T21:21:54+00:00

I have a script that involves some UI Scripting to target a phone number

  • 0

I have a script that involves some UI Scripting to target a phone number in an in-house application that does not support applescript (thus why I must UI Script). The part which I have successfully written is as follows:

tell application "System Events" to set frontmost of process "Ticket Tracker" to true
tell application "System Events"
tell process "Ticket Tracker"
try
    try
        set the_number to value of attribute "AXvalue" of static text 14 of group 1 
        of scroll area 1 of splitter group 2 of splitter group 1 of window 1

        if the_number = "" then
            set the_number to value of attribute "AXvalue" of static text 1 of 
            splitter group 1 of window 1
        end if 
    on error
        set the_number to value of attribute "AXvalue" of combo box 3 of 
        tab group 1 of scroll area 1 of splitter group 2 of splitter group 2 of 
        splitter group 1 of window 1
            if the_number = "" then
                set the_number to value of attribute "AXvalue" of static text 11 
                of tab group 1 of scroll area 1 of splitter group 2 of splitter group 2
                of splitter group 1 of window 1
            end if
    end try

The second half of this code is to try and grab the number from the 2nd newly opened window. When the first window is opened and that is the window you want to grab the number from, then “window 1” is a perfectly fine index. But if you open a new window, and your second window (the first one opened) is the one you want to grab the number from, then you have to look for “window 2”, that is why I combined the first block of code with the second and tied it together with try and on error as you can see…

on error
    try
        set the_number to value of attribute "AXvalue" of static text 14 
        of group 1 of scroll area 1 of splitter group 2 of splitter group 1 
        of window 2

        if the_number = "" then
            set the_number to value of attribute "AXvalue" of static text 1 
            of splitter group 1 of window 2
        end if
    on error
        set the_number to value of attribute "AXvalue" of combo box 3 of 
        tab group 1 of scroll area 1 of splitter group 2 of splitter group 2
        of splitter group 1 of window 2

        if the_number = "" then
            set the_number to value of attribute "AXvalue" of static text 11 
            of tab group 1 of scroll area 1 of splitter group 2 of splitter group 2
            of splitter group 1 of window 2
        end if
    end try
end try
end tell
end tell

This was a good starter concept, however other people who would use my script operate the “Ticket Tracker” application differently and would require me to search for “window indexes” as high as 6 or 7.

What I want to do is write a script object that uses the first half of the block of code that I have, and then if it fails to find “window x” to try to find “window x + 1” and to continue to try until it succeeds (with a limit of about 20). I am very new to script objects and still trying to grasp the concept but this is what I have so far:

Script indexFinder
property x : 1

to tryAgain
    set x to x + 1
try
    try
        set the_number to value of attribute "AXvalue" of static text 14 of group 1 
        of scroll area 1 of splitter group 2 of splitter group 1 of window x

        if the_number = "" then
            set the_number to value of attribute "AXvalue" of static text 1 of 
            splitter group 1 of window x
        end if 
    on error
        set the_number to value of attribute "AXvalue" of combo box 3 of 
        tab group 1 of scroll area 1 of splitter group 2 of splitter group 2 of 
        splitter group 1 of window x

        if the_number = "" then
            set the_number to value of attribute "AXvalue" of static text 11 
            of tab group 1 of scroll area 1 of splitter group 2 of splitter group 2
            of splitter group 1 of window x
        end if
    end try
on error
    repeat tryAgain
end try
end tryAgain
end script

I’m not sure if this syntax is correct but I think it encapsulates what I’m trying to accomplish. Thank you for all the help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T21:21:55+00:00Added an answer on June 11, 2026 at 9:21 pm

    You can try something like this:

    set maxWindow to 20
    
    repeat with i from 1 to maxWindow
        try
            set the_number to tTracker(i)
            exit repeat
        end try
    end repeat
    
    -- insert the rest of your script
    return the_number
    
    -- Handlers
    on tTracker(windowNumber)
        try
    
            tell application "System Events"
                set frontmost of process "Ticket Tracker" to true
                tell process "Ticket Tracker"
                    set xxx to value of attribute "AXvalue" of static text 14 of group 1 of scroll area 1 of splitter group 2 of splitter group 1 of window windowNumber
    
                    if xxx = "" then
                        set xxx to value of attribute "AXvalue" of static text 1 of splitter group 1 of window windowNumber
                    end if
                end tell
            end tell
            return xxx
    
        on error
            tell application "System Events" to tell process "Ticket Tracker"
                set xxx to value of attribute "AXvalue" of combo box 3 of tab group 1 of scroll area 1 of splitter group 2 of splitter group 2 of splitter group 1 of window windowNumber
                if xxx = "" then
                    set xxx to value of attribute "AXvalue" of static text 11 of tab group 1 of scroll area 1 of splitter group 2 of splitter group 2 of splitter group 1 of window windowNumber
                end if
            end tell
            return xxx
    
        end try
    end tTracker
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a python script called my_parallel_script.py that involves using multiprocessing to parallelize
I'm working on a small silverlight application that involves passing some data between javascript
I'm working on a project that involves some scripting and data storage. The database
Related: How to force delete a file? I have a NAnt script that does
I have script that reads remote file content and writes it to local server.
I have this script that run to fix my menu bar to the browser
I have a script that recursively loops through all the sub directories and compresses
I have a script that submits data via an ajax POST. It is called
I have following script that executes all the .reg files in the current directory.
I have a script that obtains information about the current folders and subfolders within

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.