Я бы хотел пройтись по каждому элементу в окне iTunes и попытаться щелкнуть по каждому элементу.
Я также хотел бы написать в текстовый файл, показывающий каждый элемент, на который я нажал.
Код, который я написал ниже, не работает. В частности, я получаю сообщение об ошибке процесс "iTunes" не понимает сообщение click_an_element.
Мысли о том, что я делаю не так?
Спасибо !!
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