• 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: need explanation for trivial Safari script behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: need explanation for trivial Safari script behavior


  • Subject: RE: need explanation for trivial Safari script behavior
  • From: "Stockly, Ed" <email@hidden>
  • Date: Sat, 16 Jul 2016 20:13:38 +0000
  • Thread-topic: need explanation for trivial Safari script behavior

--Question 1: why do I need as item on theWindow but not on theTab?

Don't know. (Sometimes the magic works, sometimes the magic doesn't work.)

-->Now, I want to break this up into handlers. I was pretty careful, and tried it a few different ways, but I can't get this to work. The problem occurs at the line marked ERROR.

This is not a valid repeat command:
  -- --    repeat with theTab in the tabs of theWindow as item

-->Question 2: What can I do to make it work.
-->Question 3: Is there a way to write this so i don't have to put as item everywhere?

 --    repeat with theTab in the tabs of theWindow
 --        set theTab to theTab as item

Also you may try this:

        set allWindows to the windows
 	repeat with theWindow in allWindows

and

	set allTabs to the tabs of theWindow
	repeat with theTab in allTabs



-->Question 4: I have been iterating over lists in AppleScript since it was introduced. I can't figure out why this one is giving me so much trouble. Is this perhaps just flakiness in Safari's AppleScript implementation?

That might account for safari behaving differently with windows and tabs, but dereferencing a list in a that kind of a repeat loop has been part of appleScript from the start.

-->But, I think it's designed to work the way you want, but just doesn't. In otherwords, as long as the orgiginal item is still available, the script should be able to dereference on the fly (as it seems to do with tabs)

It may be that when you've used that form of a repeat loop before, it was automatically deferencing.

You can identify when its a reference and when its and item by looking at the log, and if it says {item 1 of x} or {tab one of ...} its a reference












 _______________________________________________
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


  • Follow-Ups:
    • Re: need explanation for trivial Safari script behavior
      • From: Mitchell L Model <email@hidden>
    • Re: need explanation for trivial Safari script behavior
      • From: Mitchell L Model <email@hidden>
References: 
 >need explanation for trivial Safari script behavior (From: Mitchell L Model <email@hidden>)
 >Re: need explanation for trivial Safari script behavior (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: need explanation for trivial Safari script behavior
  • Next by Date: Re: need explanation for trivial Safari script behavior
  • Previous by thread: Re: need explanation for trivial Safari script behavior
  • Next by thread: Re: need explanation for trivial Safari script behavior
  • Index(es):
    • Date
    • Thread