提问人:PandaPlaysAll 提问时间:11/11/2023 更新时间:11/11/2023 访问量:13
AppleScript select 元素,其中仅设置了 label/text 属性
AppleScript select element where only the label/text attribute is set
问:
我想在 IntelliJ 的调试器中单击三个控制台按钮中的每一个。没有内置的快捷方式,并且在Keyboard Maestro中找到的图像的单击不起作用。
基于此,我在 ChatGPT 的帮助下构建了以下 AppleScript,但我没有得到任何运气
tell application "System Events"
tell process "WebStorm-EAP"
-- Wait until the application is ready
repeat until exists (windows)
delay 0.5
end repeat
-- Variable to store the found element
set theElement to missing value
-- Iterate through each window
repeat with theWindow in windows
-- Try to find the target element in the current window
try
-- Get all elements that could potentially be the target
set allElements to UI elements of theWindow
-- Iterate through all elements to find the target
repeat with anElement in allElements
-- Check for elements with a title or description that matches
if value of anElement is "Debugger Console" or label of anElement is "Debugger Console" then
set theElement to anElement
exit repeat
end if
end repeat
if theElement is not missing value then
exit repeat
end if
on error
-- Ignoring errors to continue searching in other windows
end try
end repeat
-- Check if the element was found and perform action
if theElement is not missing value then
click theElement
else
display alert "Element not found."
end if
end tell
end tell
答: 暂无答案
评论