Le 5 juin 2016 à 15:31, Christopher Stone < email@hidden> a écrit :
On Jun 05, 2016, at 05:53, Yvan KOENIG < email@hidden> wrote:
Caution
The index of a window may have different values. Three different lists exist.
______________________________________________________________________
Hey Yvan,
Well, it doesn't surprise me at all that the window menu does it's own thing, but I'm wondering why the indexing is different for you with vanilla AppleScript in Safari and with System Events.
------------------------------------------------------------------------------------------- tell application "System Events" tell application process "Safari" tell (windows whose subrole is "AXStandardWindow") set sevWinNameList to name end tell end tell end tell
set x to " "
tell application "Safari" set vanillaAppleScriptWinNameList to name of windows where its document is not missing value end tell
items 1 thru -2 of {¬ sevWinNameList, ¬ vanillaAppleScriptWinNameList, ¬ ""} -------------------------------------------------------------------------------------------
On my system these two come up the same:
{ { "Apple", "Apple Mac OS X Software & Apps - Discover & Download : MacUpdate", "Google", "A New Toy - Keyboard Maestro Discourse" }, { "Apple", "Apple Mac OS X Software & Apps - Discover & Download : MacUpdate", "Google", "A New Toy - Keyboard Maestro Discourse" } }
One warning – if Safari has been hidden then both methods change.
Thanks Chris.
I have no idea about what may explain what I got. As I ran two separate scripts, maybe it was due to the fact that Safari was hidden between the use of the scripts.
When I ran your two-in-one script I got identical lists.
tell application "System Events" get name of every window of application process "Safari" whose subrole = "AXStandardWindow" --> {"Apple (France)", "Slice42 / Actualités Mac & Hi-tech, tests et guides iPhone, iPad", "Gerbino en vente | eBay", "Mac4Ever.com - Toute l'actualité Apple, iPhone, iPad, iPod et Mac - Mise à jour quotidienne"} end tell tell application "Safari" get name of every window whose document ≠ missing value --> {"Apple (France)", "Slice42 / Actualités Mac & Hi-tech, tests et guides iPhone, iPad", "Gerbino en vente | eBay", "Mac4Ever.com - Toute l'actualité Apple, iPhone, iPad, iPod et Mac - Mise à jour quotidienne"} end tell
Honestly I'm not too much surprised to see such behavior. After all, my daughter born in 1970 has always difficulties to make the difference between its left and its right. It will not evolve correctly now that some politicians say that there is no difference between both of them ;-)
Yvan KOENIG running El Capitan 10.11.5 in French (VALLAURIS, France) dimanche 5 juin 2016 15:57:08
|