Hello
I was testing a piece of code when I got a surprising behavior so I built a short script displaying it.
Here it is :
activate application "AppleScript Editor" tell application "System Events" to tell process "AppleScript Editor" tell menu bar 1 to ¬ tell menu bar item 9 to tell menu 1 to name of menu items 13 thru -1 --> {missing value, "100titre.scpt", "Sans titre"} end tell
tell application "AppleScript Editor" name of windows whose visible is true --> {"100titre.scpt"} name of windows whose miniaturized is true --> {"Historique des événements", "Sans titre"} name of windows whose visible is false --> {"grab recently modified v6.scpt", "Historique des événements", "Create ITP from Client's Mail-Conversation Inquiry.scpt", "Sans titre", "Sans titre 2", "Sans titre", "Create ITP from Client's Mail-Conversation Inquiry copy 20140322.scpt", "Create ITP from Client's Mail-Conversation Inquiry.scpt", "Sans titre", "Sans titre 2", "Sans titre 2", "Create ITP from Client's Mail-Conversation Inquiry 20140322 YK.scpt"} end tell activate application "AppleScript Editor" tell application "System Events" to tell process "AppleScript Editor" tell menu bar 1 to ¬ tell menu bar item 3 to tell menu 1 to tell menu item 5 to tell menu 1 to name of menu items 1 thru -3 --> {" 100titre.scpt", " Create ITP from Client's Mail-Conversation Inquiry.scpt", " Create ITP from Client's Mail-Conversation Inquiry 20140322 YK.scpt", " grab recently modified v6.scpt"} end tell
The instructions triggering GUI Scripting return the bottom of the Windows menu. We see that two windows are available. As is, the script don't display the windows attributes. One is visible, the other is minimized. Knowing that, it's not surprising to see that the returned list of visible windows contains only one name. The other one is correctly returned as minimized one.
What is puzzling is what is returned as list of windows whose visible is false. The name which I put in bold is the minimized one. The others are in fact those which were opened today but are now closed. The ones whose name ends with .scpt were saved so they appear in the menu item "Open Recents"
I'm wondering why the editor keep the properties of windows which are now closed. I wrote « properties » because the properties of these windows are really available :
get properties of every window whose visible = false --> {{document:missing value, closeable:true, zoomed:false, class:window, index:2, visible:false, name:"grab recently modified v6.scpt", modal:false, miniaturizable:true, titled:true, id:95, miniaturized:false, floating:false, resizable:true, bounds:{478, 30, 1398, 1074}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:3, visible:false, name:"Historique des événements", modal:false, miniaturizable:true, titled:true, id:709, miniaturized:true, floating:false, resizable:true, bounds:{550, 485, 1050, 832}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:4, visible:false, name:"Create ITP from Client's Mail-Conversation Inquiry.scpt", modal:false, miniaturizable:true, titled:true, id:166, miniaturized:false, floating:false, resizable:true, bounds:{217, 31, 1399, 1072}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:5, visible:false, name:"Sans titre", modal:false, miniaturizable:true, titled:true, id:193, miniaturized:true, floating:false, resizable:true, bounds:{840, 608, 2079, 1168}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:6, visible:false, name:"Sans titre 2", modal:false, miniaturizable:true, titled:true, id:279, miniaturized:false, floating:false, resizable:true, bounds:{24, 45, 626, 698}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:7, visible:false, name:"Sans titre", modal:false, miniaturizable:true, titled:true, id:706, miniaturized:false, floating:false, resizable:true, bounds:{3, 22, 605, 675}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:8, visible:false, name:"Create ITP from Client's Mail-Conversation Inquiry copy 20140322.scpt", modal:false, miniaturizable:true, titled:true, id:808, miniaturized:false, floating:false, resizable:true, bounds:{28, 41, 952, 1093}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:9, visible:false, name:"Create ITP from Client's Mail-Conversation Inquiry.scpt", modal:false, miniaturizable:true, titled:true, id:822, miniaturized:false, floating:false, resizable:true, bounds:{252, 22, 1188, 1068}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:10, visible:false, name:"Sans titre", modal:false, miniaturizable:true, titled:true, id:826, miniaturized:false, floating:false, resizable:true, bounds:{24, 45, 626, 698}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:11, visible:false, name:"Sans titre 2", modal:false, miniaturizable:true, titled:true, id:867, miniaturized:false, floating:false, resizable:true, bounds:{45, 68, 897, 1014}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:12, visible:false, name:"Sans titre 2", modal:false, miniaturizable:true, titled:true, id:914, miniaturized:false, floating:false, resizable:true, bounds:{45, 68, 647, 721}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:13, visible:false, name:"Create ITP from Client's Mail-Conversation Inquiry 20140322 YK.scpt", modal:false, miniaturizable:true, titled:true, id:962, miniaturized:false, floating:false, resizable:true, bounds:{28, 28, 952, 1080}, zoomable:true}, {document:missing value, closeable:true, zoomed:false, class:window, index:14, visible:false, name:"Sans titre", modal:false, miniaturizable:true, titled:true, id:1069, miniaturized:false, floating:false, resizable:true, bounds:{857, 333, 1616, 1170}, zoomable:true}}
Designed feature or funny bug ?
I underlined the properties of a window which is also puzzling me. I didn't open the Event Log window as a separate one. I just display the log at the bottom of the script window. Why is it reported here ?
Yvan KOENIG (VALLAURIS, France) samedi 22 mars 2014 18:11:29
|