I have a UI element called accessibillityTitle
with value Layers
and I want to position this element in the top right corner, but I don't know how to acces it via Applescript. I have found the element using Accessibility Inspector
and here is what the rest looks like.
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
How can I use set position to {1280, 0}
to this element?
Best Answer
Actually I dealt with a similar case, when I wanted to move a previously generated dialog to the top-right corner of my screen.
I only succeeded in doing so thru a 2nd script that was launched simultaneously, but had a "repeat nothing until" loop built in to await the dialog's pop-up. In my experience, no matter what I tried, the dialog would hinder an "in-script moving" while its window stayed open ...
(I attached both to a folder: I just had to add #2 to its list.)
In script #1 the final command reads:
The 2nd one:
You can see there's a (minute) delay after "repeat-nothing". Even waiting 0.1s sometimes my MacMini's so busy that the delay's too short, and the dialog remains centered ...
(To make sure set a higher value, say: 0.5.)
My "Recent downloads" Workaround #2 for Safari can be found HERE.