通过Applescript设置元素accessibillityTitle的位置{0,0}


0

我有一个accessibillityTitle带有值的UI元素Layers,我想将此元素放在右上角,但我不知道如何通过Applescript访问它。我找到了使用的元素Accessibility Inspector,其余部分就是这样。

AXApplication
    AXWindow:AXDialog
Attributes
    isAccessibilityFocused  NO
    accessibilityTitle  Layers
    accessibilityGrowArea   <nil>
    accessibilityMinimizeButton <nil>
    accessibilityDocument   <nil>
    accessibilityCloseButton    <nil>
    isAccessibilityMain NO
    accessibilityFullScreenButton   <nil>
    accessibilityProxy  <nil>
    accessibilityDefaultButton  <nil>
    isAccessibilityMinimized    NO
    accessibilityChildren   10 items
    accessibilityRole   AXWindow
    accessibilityParent <AXApplication>
    accessibilityTitleUIElement <nil>
    accessibilityCancelButton   <nil>
    isAccessibilityModal    NO
    accessibilitySubrole    AXDialog
    accessibilityZoomButton <nil>
    accessibilityRoleDescription    dialog
    accessibilityToolbarButton  <nil>
    accessibilityFrame  x=1038.00 y=23.00 w=240.00 h=773.00
    accessibilityIdentifier com.pixelmatorteam.pixelmator.layers.palette
Actions
    accessibilityPerformRaise

set position to {1280, 0}该如何使用这个元素?

Answers:


1

实际上,当我想将之前生成的对话框移动到屏幕的右上角时,我处理了类似的情况。
我只是通过同时启动的第二个脚本成功完成了这个操作,但是在内置“重复任何内容”循环以等待对话框的弹出窗口。根据我的经验,无论我尝试什么,对话框都会在窗口保持打开状态时阻碍“脚本移动”...
(我将两者都附加到一个文件夹中:我只需将#2添加到其列表中。)

在脚本#1中,最终命令为:

tell application "Finder" to display dialog DL_display as string with ¬
  title "Recent downloads" buttons {"Close"} default button 1

第二个:

tell application "Finder"
    set screenRgt to bounds of the window of desktop  --> independent of
    set rightEdge to (item 3 of screenRgt) - 425      --> screen resolution
end tell
tell application "System Events" to tell process "Finder"
    repeat while not (exists window "Recent downloads")
    end repeat
    delay 0.1
    set position of window "Recent downloads" to {rightEdge, 61}
end tell

你可以看到“重复无”之后有一分钟的延迟。即使等待0.1秒,有时我的MacMini也很忙,延迟时间太短,对话仍然居中......
(为了确保设置更高的值,比如说:0.5。)
我的“最近下载”解决方案#2 for Safari可以找到HERE

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.