Applescript中的鼠标单击位置可以使用绝对或相对坐标来指定。绝对坐标是从屏幕的左上角开始计算的,而相对坐标是基于当前鼠标位置的。
以下是使用绝对坐标进行鼠标单击的示例代码:
-- 单击屏幕上绝对坐标为(100,100)的位置
-- (请注意,这可以与其他应用重叠)
tell application "System Events"
click at {100, 100}
end tell
以下是使用相对坐标进行鼠标单击的示例代码:
-- 获取当前鼠标位置的坐标
tell application "System Events"
set mousePosition to position of the mouse
end tell
-- 单击当前位置下20像素和20像素的位置
tell application "System Events"
-- 添加相对于当前鼠标位置的像素偏移量
set clickPosition to {item 1 of mousePosition + 20, item 2 of mousePosition + 20}
click at clickPosition
end tell
通过这些示例代码,你可以选择使用绝对或相对坐标的方法,来实现你需要的鼠标单击操作。