从 Applescript 中的文件名列表中选择一个项目
Selecting a item from a list of filenames in Applescript
我的应用程序需要从 iTunes 的 "Import Playlist" 对话框显示的文件名列表中 select 一个给定的文件名。根据 Accessibility Inspector,大多数列表的父项都没有描述,其中一个项目被描述为 "NSBox"。
我的具体问题是尝试将“[NSBox]”引用为 "group 1" 失败,运行时错误基本上是说数字太大了?!
这与我之前的问题 几乎相同, 只有 的答案提供了当时完成我的特定任务的另一种方法。
标有 * 而不是 - 的列表项是我在辅助功能检查器中 select 编辑的实际项目。在一个示例中,我需要 select 的特定项目的完整层次结构是:
- 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 称为 "outline",所以具体的解决方案是 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"
是的,这是 "its"].[=11 的正确拼写=]
我的应用程序需要从 iTunes 的 "Import Playlist" 对话框显示的文件名列表中 select 一个给定的文件名。根据 Accessibility Inspector,大多数列表的父项都没有描述,其中一个项目被描述为 "NSBox"。 我的具体问题是尝试将“[NSBox]”引用为 "group 1" 失败,运行时错误基本上是说数字太大了?!
这与我之前的问题
标有 * 而不是 - 的列表项是我在辅助功能检查器中 select 编辑的实际项目。在一个示例中,我需要 select 的特定项目的完整层次结构是:
- 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 称为 "outline",所以具体的解决方案是 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"
是的,这是 "its"].[=11 的正确拼写=]