• 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: Christopher Stone <email@hidden>
  • Date: Fri, 15 Jul 2016 17:41:14 -0500

On Jul 15, 2016, at 15:56, Mitchell L Model <email@hidden> wrote:
I am bewildered by the behavior of this most trivial Safari repeat.


Hey Mitchell,

As Ed mentions log is not dereferencing theWindow.

--------------------------------------------------------------------------
tell application "Safari"
   repeat with theWindow in (windows where its document is not missing value)
      log (get name of theWindow)
   end repeat
end tell
--------------------------------------------------------------------------

theWindow is a pointer/reference unless/until it is dereferenced, and that can be very confusing until you get accustomed to it.

One use for this is changing list items in-place:

--------------------------------------------------------------------------
tell application "Safari"
set winList to windows where its document is not missing value
repeat with theWindow in winList
set contents of theWindow to name of theWindow
end repeat
end tell

winList
--------------------------------------------------------------------------

--
Best Regards,
Chris

 _______________________________________________
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: 
 >need explanation for trivial Safari script behavior (From: Mitchell L Model <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