简体   繁体   中英

Selecting a item from a list of filenames in Applescript

My app needs to select a given filename from a list of filenames presented by iTunes' "Import Playlist" dialog. According to Accessibility Inspector the majority of the list's parent have no description and one item is described as an "NSBox". MY SPECIFIC PROBLEM IS THAT TRYING TO REFER TO THE "[NSBox]" AS "group 1" FAILS WITH THE RUNTIME ERROR ESSENTIALLY SAYING THE NUMBER IS TOO LARGE?!

This is a near identical situation to my earlier question How do I refer to an object in a window whose Accessibility Inspector description is "<empty description> (group) [NSBox]" in Applescript? for which the only answer presented an alternate method of accomplishing my specific task at the time.

The list item marked with a * rather than a - is the actual item I had selected in Accessibility Inspector. The full hierarchy of the specific item I need to select in one example case is:

- iTunes (application) [ITNSApplication]
- import (dialog) [NSOpenPanel]
- <empty description> (group) [NSBox]
- <empty description> (split group) [Fl_TSplitView]
- <empty description> (split group) [Fl_TSplitView]
- <empty description> (scroll area) [Fl_TListScrollView]
- (list view) [Fl_TListView]
- <empty description> (outline row) [NSOutlineRow]
* Library.xml (cell) [NSTableViewCellMockElement]
    - Library.xml (text field) [Fl_TListNameFieldCell]
    - <empty description> (image) [NSImageCell)

[NSBox]被Applescript称为“概述”,因此特定的解决方案将tell app "System Events" to tell process "iTunes" to select row [number or variable here] of list view 1 of scroll area 1 of split group 1 of split group 1 of group 1 of window "import" [or "its front window" ,是的,这是“其”的正确拼写]的tell app "System Events" to tell process "iTunes" to select row [number or variable here] of list view 1 of scroll area 1 of split group 1 of split group 1 of group 1 of window "import" [or "its front window"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM