• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: strange behavior setting window index to 1 in Safari
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: strange behavior setting window index to 1 in Safari


  • Subject: Re: strange behavior setting window index to 1 in Safari
  • From: Yvan KOENIG <email@hidden>
  • Date: Sun, 05 Jun 2016 15:57:13 +0200


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.

--
Take Care,
Chris

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



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >strange behavior setting window index to 1 in Safari (From: Mitchell L Model <email@hidden>)
 >Re: strange behavior setting window index to 1 in Safari (From: Christopher Stone <email@hidden>)
 >Re: strange behavior setting window index to 1 in Safari (From: David Gregg <email@hidden>)
 >Re: strange behavior setting window index to 1 in Safari (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: strange behavior setting window index to 1 in Safari
  • Next by Date: Re: How to create a document?
  • Previous by thread: Re: strange behavior setting window index to 1 in Safari
  • Next by thread: How to create a document?
  • Index(es):
    • Date
    • Thread