Click every element in a window via GUI Scripting

Hi, 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 clickanelement 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
clickanelement(ele)
showwhat_youclicked(ele)
end repeat
end tell
end tell
-------handlers------------
to clickan_element(anelement)
tell application "iTunes" to activate
tell application "System Events"
tell process "iTunes"
try
click an_element
end try
end tell
end tell
end clickanelement
to showwhat_you_clicked(thing_totype)
tell application "TextEdit" to activate
tell application "System Events"
tell process "TextEdit"
keystroke thingtotype
key code 36
end tell
end tell
end showwhat_youclicked

I don't know what you're trying to do, but Welcome to Apple Discussions!
You can started like this, but I think the first click is going to close the iTunes window!
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFDDFF;
overflow: auto;">
tell application "iTunes" to activate
tell application "System Events"
tell process "iTunes"
set elements to get entire contents of window "iTunes"
repeat with anElement in elements
try
click anElement
end try
end repeat
end tell
end tell
end </pre>

Similar Messages

  • Activate a session via Gui scripting

    Hi,
    how to activate an active SAP-session via Gui Scripting or maybe a workaround?
    There are some SAP sessions running and I want to activate a certain one of them.
    I tried to activate a session with:
    AppActivate session.findById("wnd[0]").Text
    but, as we know, if there are the same task names in Task Manager, the function will start any one of them.
    Any idea?
    Edited by: Stefan Benkö on Feb 9, 2009 7:07 AM

    Dear Casmir,
    I use the following code:
                suFound = False
                suError = False
                sgSystem = Trim(Cells(Target.Row, scSysCol))
                sgClient = Trim(Cells(Target.Row, scCliCol))
                sgUser = Trim(Cells(Target.Row, scUsrCol))
                sgPW = Trim(Cells(Target.Row, scPwdCol))
                suError = True
                suError = Not ssApplication
                If suError Then GoTo StopSub
                For Each suConnection In sgApplication.Connections
                    suSysName = suConnection.Description
                    If suSysName = sgSystem Then
                        For Each suSession In suConnection.sessions
                            suSysClient = suSession.info.client
                            If suSysClient = sgClient Then
                                AppActivate suSession.findById("wnd[0]").Text
                                'Aktive Instanz herausfinden, SID/Client checken
                                Set suAkt = sgApplication.ActiveSession()
                                suAktName = suAkt.Parent.Description
                                suAktClient = suAkt.info.client
                                If sgSystem <> suAktName Or sgClient <> suAktClient Then
                                    If Not suFound Then
                                        suFound = True
                                        AppActivate "Microsoft Excel"
                                        A = MsgBox(sgSystem & " - " & sgClient & "  NOT selectable", vbOKOnly + vbCritical + vbDefaultButton1, "SAP Automation")
                                    End If
                                Else
                                    suFound = True
                                End If
                                Exit For
                            End If
                            suSysClient = ""
                        Next
                    End If
                    If suFound Then Exit For
                    suSysName = ""
                Next
    As you can see, I got at that point all the necessary session and connection data.
    There are several SAP-Tasks open and what I want is to get a specific one as active window on my screen. That doesn't work if the sessions have the same Task-name, for instance "SAP Easy Access". Because Windos is not albe to find the right SAP-task - they have the same name - and it takes usally the wrong one of them. Thats my problem.
    Many Thanks for your Help

  • Applescript GUI scripting, selecting a window element

    HI everyone,
    I have an issue where I need to programmtically generate a list of Activation Requests for the ColorEyes Display Pro application. In order to get the info I need, I have to launch the app while holding the command and shift keys, then select from a drop down list. The information does present as a field that I can select and copy, but I can't figure out how to simulate a click on that field.
    I have every piece of this together except what UI element I need to access and how to select it so I can save it in a varialbe or at least copy and paste it.
    I’m only interested in the request number item of Show Field Data. Here is the code I’ve written so far:
    tell application "System Events"
        key down command
       key down shift
       do shell script "open '/Applications/ColorEyes Display Pro/ColorEyes Display Pro.app'"
        delay 10
        key up command
       key up shift
       tell process "QuickLicenseRT"
            delay 3
            click pop up button 1 of window "License Options"
            key code 125 -- down arrow key
           key code 125 -- down arrow key
           keystroke return
           delay 1
            click UI element 33 of window "License Options" --- this doesn't seem to be right. Don't know what it would be
            --delay 1
           --keystroke return
           --delay 1
           --keystroke return
       end tell
    end tell
    and the events I get when running the code:
    tell application "System Events"
       key down command
       key down shift
       do shell script "open '/Applications/ColorEyes Display Pro/ColorEyes Display Pro.app'"
           --> error number -10004
    end tell
    tell current application
       do shell script "open '/Applications/ColorEyes Display Pro/ColorEyes Display Pro.app'"
           --> ""
    end tell
    tell application "System Events"
       key up command
       key up shift
       click pop up button 1 of window "License Options" of process "QuickLicenseRT"
           --> pop up button 1 of window "License Options" of application process "QuickLicenseRT"
       key code 125
       key code 125
       keystroke "
       click UI element 33 of window "License Options" of process "QuickLicenseRT"
           --> missing value
    end tell
    Result:
    missing value
    The script runs and opens color eyes and gets to the show field data window and selects it. I can see the request number, but cant get that data into a variable.
    This is what a short applescript I found to list the elements of a given window says about this QuickLicenseRT window:
    I also have screen shots of what the QuickLicenseRT window looks like:
    The request number is different on each Mac, and I need to know which ones are active and which aren't. These activations are distributed globally so I HAVE to be able to do this programmatically.
    Any ideas?
    TIA!
    Andrew

    I can't answer directly, but there are numerous other reports of text fields not 'sticking' via UI scripting (not just in WGM).
    If it's not too late, I wouldn't recommend using UI scripting for such a large task. There are too many variables that could mess it up.
    If you haven't run the import yet I'd recommend taking a look at dscl, the Directory Service Command Line tool - it lets you manipulate any data in your directory via a command line interface. It should be more robust than UI scripting when dealing with mass updates like this.

  • Need help with GUI Scripting Audio Midi Setup

    I want to read the value of the sampling frequency set by default in Audio Midi Setup.
    If there is an easy unix way to gleen this, please let me know. Otherwise, I am trying to get it via GUI scripting. I think I am almost there, but am doing something stupid.
    Here is what I have:
    tell application "Audio MIDI Setup"
    activate
    end tell
    tell application "System Events"
    activate
    tell application process "Audio MIDI Setup"
    select window 1
    select group
    select tab group
    select group
    select combo box
    set FrequencyValue to contents of combo box
    end tell
    end tell
    Basically, this comes down to the question of how to extract the default text field from the combo box.

    Once you click on the combo box to get the list of items, you can do stuff with the results. The easiest thing would probably be to use the up and down arrows to change the selection, since the text field is not editable. You can compare the list of items with the current value and do something from there - how do you plan to choose the item to change to?
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    tell application "Audio MIDI Setup" to activate
    tell application "System Events" to tell application process "Audio MIDI Setup"
    set comboBox to combo box 1 of group 1 of tab group 1 of group 1 of window "Audio Devices"
    set frequencyValue to value of comboBox -- get current value
    click button 1 of comboBox -- perform action "AXPress" to drop the list
    set theChoices to value of text fields of list 1 of scroll area 1 of comboBox -- get all the values
    -- keystroke (ASCII character 31) -- down arrow
    -- keystroke (ASCII character 30) -- up arrow
    -- keystroke return -- select and dismiss the list
    end tell
    activate me
    choose from list theChoices default items {frequencyValue} -- just show the results
    </pre>

  • I keep getting a dialogue box asking me if i want to open or save a firefox document every time i click on an email in windows outlook; what can i do to fix this? thank you.

    Question
    i keep getting a dialogue box asking me if i want to open or save a firefox document every time i click on an email in windows outlook; what can i do to fix this? thank you

    Thanks for getting back to me; i was not able to get to the computer until now.
    No, not thru web access; it is via the Outlook provided thru Microsoft Office.

  • I have Adobe Photoshop Elements 10. It came installed on my HP Desktop. I am can not get the warp text tool to work. It has worked in the past. Once I click warp text, the little window does not pop up, and if I try to do anything else after I click warp

    I have Adobe Photoshop Elements 10. It came installed on my HP Desktop. I am can not get the warp text tool to work. It has worked in the past. Once I click warp text, the little window does not pop up, and if I try to do anything else after I click warp text, it wont let me. Just sounds the ding, alert, can still slightly navigate the program but can not use any other tools after clicking warp text. I just have to open task manager and close the program. not sure if I'm doing something wrong or maybe I just need to uninstall and re install. Having trouble finding out how to uninstall and reinstall because the program came pre installed on my desktop.

    It actually sounds like the warp text window is opening off screen.
    Resetting the photoshop elements 10 preferences should fix it.
    *Press and hold the Shift+Ctrl+Alt keys just after you start the launch of the photoshop elements 10 editor
    *Keep holding the keys down until you get a dialog asking if you want to delete the adobe photoshop elements setting file
    *Press Yes

  • I am trying to surf the Net and every time I click the SAFARI button, a window pops up saying that this application was closed all of a sudden

    I am trying to surf the Net and every time I click the SAFARI button, a window pops up saying that this application was closed all of a sudden. What can I do to solve this problem?

    How are you connecting to this website?

  • Have sound but no picture when i click on the video.Elements 10 on windows 7.Can you help.

    Have sound but no picture when i click on the video.Elements 10 on windows 7.Can you help.

    Bigal.seamills
    What is the driver version for your NVIDIA GeForce GT640?
    There is a known issue specific to Premiere Elements 10 and NVIDIA GeForce. The Announcement at the top of this forum tells it all - detailed description of problem, references, fixes, and fix details.
    The following is a copy paste of that Announcement....
    If you are a Premiere Elements 10 user whose Windows computer uses a NVIDIA GeForce video card
    and you are experiencing Premiere Elements 10 display and/or unexplained program behavior, then your
    first line of troubleshooting needs to be rolling back the video card driver version instead of assuring that
    it is up to date.  
    Since October 2013 to the present, there have been a growing number of reports about display and
    unexplained workflow glitches specific to the Premiere Elements 10 user whose Windows computer
    has a NVIDIA GeForce video card. If this applies to you, then the “user to user” remedy is to roll back
    the NVIDIA GeForce video card driver as far as is necessary to get rid of the problems. The typical driver
    roll back has gone back as far as March – July 2013 in order to get a working Premiere Elements 10.
    Neither NVIDIA nor Adobe has taken any corrective action in this regard to date, and none is expected moving forward.   
    Since October 2013, the following thread has tried to keep up with the Premiere Elements 10 NVIDIA reports
    http://forums.adobe.com/thread/1317675  
    Older NVIDIA GeForce drivers can be found  NVIDIA Driver Downloads - Advanced Search   
    A February 2014 overview of the situation as well as how to use the older NVIDIA GeForce drivers for
    the driver roll back can be found  http://atr935.blogspot.com/2014/02/pe10-nvidia-video-card-roll-back.html
    Please refer to the following for the driver version history of your NVIDIA card
    Based on history, you should be using
    GeForce 320.18 Driver
    320.18
    May 23, 2013
    Please review and consider and then let us know the results.
    Thank you.
    ATR

  • Hi everyone i tried to modify BCA so i can use a usb to load windows via BCA but now it doesn't load when i double click it!?

    i tried to modify BCA so i can use a usb to load windows via BCA but now it doesn't load when i double click it!? any ideas?

    iv solved it now

  • How do I stop firefox from opening every link I click on in a new window instead of loading it in that window?

    Whenever I click a link to bring me to a game or maybe a different website, it opens it into a new window which keeps certain things from working.
    == This happened ==
    Every time Firefox opened
    == I clicked "open in a new window" on a tab so i could have two windows

    Hello,
    In safe mode link still open in new tabs?
    *[http://mzl.la/MwuO4X Firefox in safe mode]
    Go to '''about:config''' and search for:
    *'''browser.tabs.loadInBackground''' change its value to '''false'''.
    If in safe mode the links still open in new tabs try go to '''about:config''' and search for:
    *'''browser.link.open_newwindow''' change its value to '''3'''.
    *[http://kb.mozillazine.org/About:config about:config]

  • If you have many tabs open (in my case 30 tabs), you cannot click every single tab with your mouse, you can only reach them by opening the tab list at the right

    If you have many tabs open (in my case 30 tabs), you cannot click every single tab with your mouse, you can only reach them by opening the tab list at the right.

    You can create a folder with the home pages by using "Bookmark All Tabs" to open a specific page.
    You can place that folder on the bookmarks toolbar or use the Bookmarks menu button that you can find in the toolbar palette to get access to that folder easily.
    * Open the Customize window via "View > Toolbars > Customize" or via "Firefox > Options > Toolbar Layout"
    * "Bookmark All Tabs" can be accessed via the right-click context menu of a tab on the tab bar.
    * "Bookmark This Page" can be accessed via the right-click context menu of that browser page.

  • Elements 11 Preview Window not visible in dual monitor mode

    When I go to dual monitor mode the preview window is hidden. I can still hear the audio from the clip but I can't see the video window. It is still hidden when I switch back to single monitor mode. The only way to bring it back is to close out the program and reopen it. Does anyone know where it goes and how to make it visible?

    MAINEEDIT
    I have just set up for Premiere Elements 11 Dual Monitor Mode in Windows 8 64 bit computer.
    How do you have your monitors set up...Extend Across.. or other?
    I am not having any problems keeping track of what I believe you are referring to as the "Preview Window". So please excuse
    if I double check with you via the following screenshot.
    Preview Window which can be brought up
    a. double clicking the file in Project Assets
    b. double clicking the file on the Expert workspace Timeline
    I am going to go over this one more time with my Premiere Elements 11 and Windows 8 64 bt computer to see
    if I can create the situation that I am interpreting that you have.
    Thanks.
    ATR
    Add On...This especially makes me ask....
    When I reopen the program the preview window appears in its normal position.
    The Preview Window is going to close when you save/close the project. As you saying that you re-opened the project
    to find the Preview Window opened?

  • Trying to install Premiere Elements 10 on Windows 7 but keep getting error message 'A reduced set of content has been installed' - help!

    We bought Premiere Elements 10/Photoshop Element 10 a while ago and it worked brilliantly on our Window XP machine, but since we moved to Windows 7 last year we can't get Premiere Elements 10 to work properly and always get the error message 'A reduced set of content (Instant Movie Themes, Title and Menu templates, etc) has been installed. You can install the full content by inserting your Content DVD or downloading it. Do you want to install now?'. So I've tried reinserting the DVDs and installing them. I've uninstalled all the software and started again, but each time I get the same message at the end of the process. I've spoken to the computer shop I bought the computer from and they say Windows 7 is incompatible, but that doesn't seem to be what the Adobe web site says. Please, any advice welcome as I've got a year's worth of videos I need to edit.
    Thank you!
    Adobe Premiere Elements 10.0 
    Windows 
    2 GHz or faster processor with SSE2 support; dual-core processor required for HDV or AVCHD editing and Blu-ray or AVCHD export.
    Microsoft Windows XP with Service Pack 2, Windows Media Center, Windows Vista® (all applications run native on 32-bit operating systems and in 32-bit compatibility mode on 64-bit operating systems), or Windows 7 (Adobe® Premiere® Elements Editor runs native on 32-bit and 64-bit operating systems; all other applications run native on 32-bit operating systems and in 32-bit compatibility mode on 64-bit operating systems)

    cathyj
    Are you working with Windows 7 32 bit or 64 bit? What video card/graphics card does your computer use? NVIDIA GeForce? And, are you doing your download and installing with antivirus and firewall(s) disabled?
    Premiere Elements 12 is compatible with Windows 7, 8, or 8.1 64 bit.
    If you have tried to obtain the Premiere Elements 10 Content from the installation disc labelled for Content for your version and operating system and that is not working, then can try downloading and installing the Content from the following Adobe link if you do not decide to click on the message to initiate the content download from within the program.
    http://www.adobe.com/special/premiereel/downloads/
    We will be watching for your progress.
    ATR

  • Transferring Premiere Elements 11 from Windows 7 to Windows 8 computer question

    Do i have to use my backups to reinstall Premiere Elements correctly, or can i simply add the internal drive i used in Windows 7 strictly for Premiere, move it to the new Windows 8 computer, reinstall the Elements program, and direct it to the proper hard drive?  I have current incremental backups on a NAS drive, but it seems like i should just be able to use the internal drive that already has everything on it.
    Thanks,

    awgriffey2013
    What do you have -  purchased installation files/serial number from an online purchase from Adobe direct or installation disc with serial number purchased in boxed packaging from an authorized reseller.
    If you do not plan on using 11 on Windows 7 thereafter,
    Deactivate 11 on 7, Help Menu/Deactivate - close out of there
    Uninstall Control Panel Route
    Deactivate and uninstall are not the same thing. Depending on your plans, you may not want to uninstall, just deactivate.
    You are simply going to install Premiere Elements 11 to Windows 8 computer, using installation files or installation disc.
    Do you have Premiere Elements 11 Windows 7 projects that you want to salvage? If so, how many? I would archive them
    File Menu/Project Archiver/Copy Project and transfer the Copied Folder via USB to the Windows 8 computer.
    For Elements Organizer considerations, please review the following
    http://helpx.adobe.com/photoshop-elements/kb/backup-restore-move-catalog-photoshop.html
    At this time I have no comments on your backups on NAS and how it might relate to your end goal.
    Please review the above and then let us know if any of the above works for you.
    Thanks.
    ATR
    Add On...Just in case note, Adobe allows you to install/activate the purchase serial number for a given product on no more than
    2 of your computers.  Then use these same products with the same activated serial number one at a time.

  • Internal DVD Drive isn't working... must install Windows via Boot Camp

    My internal DVD Drive has died. Just keeps ejecting every CD or DVD I put in it.
    *The real problem is that i need to install Windows via BootCamp...*
    I've already defraged my Hard Drive and partioned it for the Windows installation
    But even using an external USB DVD Drive I couldn't get to boot up from it
    to install Windows XP SP3.
    BootCamp lets me use the windows disc that is inside my external DVD drive
    and it even restarts... but after the restart chime, and the grey screen, it doesn't
    start the windows installation... it continues to boot to my Mac partition.
    (i've tried to manually change the boot disc in System Preferences, but it was in vain)
    I also tried to use another Mac's DVD drive in Target Disk Mode... no results.
    I even tried to Copy-Paste the entire file system of a Windows installation from a BootCamp of a friend but had no success making it to work.
    *Is there any way I can install Windows with my external DVD drive?*
    Because I don't have the cash for buying a new one right now...
    And I really need windows installed via BootCamp...
    Thanks in advance,

    For this problem there no alternative > I bought a new internal DVD drive and then I was able to install Windows via Bootcamp.

Maybe you are looking for

  • File Dialog Box

    Hi I am using struts framework for my web application, and i am working on reports section, i want File Dialog box like open,save when i click generate report button , so user can save generated report in his local system.how can we do this..currentl

  • BI : VENDOR DATASOURCE Hidden Fields

    Hi Experts , In the 0vendor_attr datsource, there were hidden fields. without unticking the fields, I loaded the data for the 0vendor infoobject . I wanted to bring the hidden fields data as well. in rsa6, I have edited the datasource,unticked the hi

  • Can I install Photoshop CS6 on a Microsoft Surface 2?

    Is it possible to install Photoshop CS6 on my Microsoft Surface 2? I use this program at work (first time Photoshop user) so I would like to use the same thing at home or something similar since I am still learning. Thanks!

  • Internet Recovery - Mountain Lion

    My MBA-2013 comes with Mountain Lion so I did not purchase it from the Apple Store (when I go to App Store, it says to purchase it). If I have to do Internet Recovery at a later time, would I be required to buy a license copy from the App store? I pl

  • Cannot close iphoto other than force quit

    help- i cannot close iphoto- I am trying to clean up and eliminate old photos as I am running out of space- i have tried moving out my preference library as suggest in a prior post - still no luck- any suggestions? gail