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 855581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:05:54+00:00 2026-05-15T08:05:54+00:00

I’d like to iterate through every element on an iTunes window and try to

  • 0

I’d like to iterate through every element on an iTunes window and try to click on each element.

I’d also like to write to a text file showing each element that I’ve clicked.

The code that I wrote below isn’t working. Specifically, I get the error process “iTunes” doesn’t understand the click_an_element message.

Thoughts on what I’m doing wrong?

Thanks!!

tell application "iTunes" to activate
tell application "System Events"
    tell process "iTunes"

        set elements to get entire contents of window "iTunes"
        repeat with i from 1 to (length of elements)
            set ele to item i of elements
            click_an_element(ele)
            show_what_you_clicked(ele)
        end repeat
    end tell
end tell


-------handlers------------
to click_an_element(an_element)
    tell application "iTunes" to activate
    tell application "System Events"
        tell process "iTunes"
            try
                click an_element
            end try
        end tell
    end tell
end click_an_element

to show_what_you_clicked(thing_to_type)
    tell application "TextEdit" to activate
    tell application "System Events"
        tell process "TextEdit"
            keystroke thing_to_type
            key code 36
        end tell
    end tell
end show_what_you_clicked
  • 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-05-15T08:05:54+00:00Added an answer on May 15, 2026 at 8:05 am

    your out of scope it thinks click_an_element is an itunes function

    you need to add “my” to that call

    Edit: since a had some time over lunch I play around with this a little bit had to turn off clicking because it was clinking minimize button then not giving access to the other items

      tell application "iTunes" to activate
      tell application "System Events"
        tell process "iTunes"
            set elements to get entire contents of window "iTunes"
        end tell
        repeat with i from 1 to (length of elements)
            set ele to item i of elements
            --my click_an_element(ele)
            my show_what_you_clicked(description of ele)
        end repeat
      end tell
    
    
      -------handlers------------
      to click_an_element(an_element)
        tell application "iTunes" to activate
        tell application "System Events"
            tell process "iTunes"
                try
                    click an_element
                end try
            end tell
        end tell
      end click_an_element
    
      to show_what_you_clicked(thing_to_type)
        tell application "TextEdit" to activate
        tell application "System Events"
            tell process "TextEdit"
                keystroke thing_to_type
                key code 36
            end tell
        end tell
      end show_what_you_clicked
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have text I am displaying in SIlverlight that is coming from a CMS
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to loop through a bunch of documents I have to put
I have some data like this: 1 2 3 4 5 9 2 6
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small

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.