Le 13 févr. 2012 à 13:23, Axel Luttgens a écrit : Le 13 févr. 2012 à 09:58, KOENIG Yvan a écrit : [...]
At this time I continue to search an explanation to the fact that I am unable to get System Events to return the Window's properties listed in its dictionary.
Am’I dumb or is there something wrong in the dictionary ?
Hello Yvan, To say the least, it is a bit confusing... There is the window object from the Standard Suite; should System Events somehow make use of windows, those windows would have the corresponding set of properties. Then, there's the window object defined in the Processes Suite; this is the kind of object made available when accessing processes from System Events. HTH, Axel
Hello Axel.
My problem is that in the System Events dictionary we may read :
elements properties bounds (rectangle) : The bounding rectangle of the window. closeable (boolean, r/o) : Whether the window has a close box. document (document, r/o) : The document whose contents are being displayed in the window. floating (boolean, r/o) : Whether the window floats. id (integer, r/o) : The unique identifier of the window. index (integer) : The index of the window, ordered front to back. miniaturizable (boolean, r/o) : Whether the window can be miniaturized. miniaturized (boolean) : Whether the window is currently miniaturized. modal (boolean, r/o) : Whether the window is the application's current modal window. name (text) : The full title of the window. resizable (boolean, r/o) : Whether the window can be resized. titled (boolean, r/o) : Whether the window has a title bar. visible (boolean) : Whether the window is currently visible. zoomable (boolean, r/o) : Whether the window can be zoomed. zoomed (boolean) : Whether the window is currently zoomed.
but when I ask the window's properties in a tell process block I get an other set of infos.
tell application "Preview" activate try name of windows on error --> error number -1708 end try try properties of window 1 on error --> error number -1708 end try try properties of document 1 on error --> error number -1708 end try end tell tell application "System Events" tell application process "Preview" title of every window --> {"télérupteur.pdf (1 page)"} properties of window 1 --> {minimum value:missing value, orientation:missing value, position:{1256, 144}, class:window, role description:"fenêtre standard", accessibility description:missing value, focused:false, title:"télérupteur.pdf (1 page)", size:{866, 1046}, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:"AXWindow", entire contents:{}, subrole:"AXStandardWindow", selected:missing value, name:"télérupteur.pdf (1 page)", description:"fenêtre standard"}
class of every UI element -->{window, menu bar} properties of first UI element --> {minimum value:missing value, orientation:missing value, position:{1256, 144}, class:window, role description:"fenêtre standard", accessibility description:missing value, focused:false, title:"télérupteur.pdf (1 page)", size:{866, 1046}, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:"AXWindow", entire contents:{}, subrole:"AXStandardWindow", selected:missing value, name:"télérupteur.pdf (1 page)", description:"fenêtre standard"} end tell end tell
How may I get the properties described as belonging to a window ? My understanding is that the list reproduced above is not related to System Events. It's no more the list of properties returned in a tell application block, when (and only when) the triggered app is scriptable
tell application "TextEdit" activate try name of windows --> {"DAZ - Serial Number Information.rtf"} on error --> end try try properties of window 1 --> {document:document "DAZ - Serial Number Information.rtf", closeable:true, zoomed:false, class:window, index:1, visible:true, name:"DAZ - Serial Number Information.rtf", modal:false, miniaturizable:true, titled:true, miniaturized:false, floating:false, id:832, resizable:true, bounds:{241, 68, 786, 923}, zoomable:true} on error --> end try try properties of document 1 --> {modified:false, path:"/Users/yvankoenig/Library/Containers/com.apple.TextEdit/Data/Desktop/DAZ - Serial Number Information.rtf", class:document, name:"DAZ - Serial Number Information.rtf", text:"blahblahblah"} on error --> end try end tell tell application "System Events" tell application process "TextEdit" title of every window --> {"DAZ - Serial Number Information.rtf"} properties of window 1 --> {minimum value:missing value, orientation:missing value, position:{241, 68}, class:window, role description:"fenêtre standard", accessibility description:missing value, focused:false, title:"DAZ - Serial Number Information.rtf", size:{545, 855}, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:"AXWindow", entire contents:{}, subrole:"AXStandardWindow", selected:missing value, name:"DAZ - Serial Number Information.rtf", description:"fenêtre standard"} class of every UI element -->{window, menu bar} properties of first UI element --> {minimum value:missing value, orientation:missing value, position:{241, 68}, class:window, role description:"fenêtre standard", accessibility description:missing value, focused:false, title:"DAZ - Serial Number Information.rtf", size:{545, 855}, value:missing value, help:missing value, enabled:missing value, maximum value:missing value, role:"AXWindow", entire contents:{}, subrole:"AXStandardWindow", selected:missing value, name:"DAZ - Serial Number Information.rtf", description:"fenêtre standard"} end tell end tell
If you look carefully, you will see that the path returned in the Document's properties is not the "true" document's path. In fact, the document is stored on the Desktop. To get the true path, I must trigger POSIX file.
POSIX file "/Users/yvankoenig/Library/Containers/com.apple.TextEdit/Data/Desktop/DAZ - Serial Number Information.rtf" --> file "Macintosh HD:Users:yvankoenig:Desktop:DAZ - Serial Number Information.rtf"
It seems that «The times they are a-changin'»
Yvan KOENIG (VALLAURIS, France) lundi 13 février 2012 14:58:59 |