Re: need explanation for trivial Safari script behavior
Re: need explanation for trivial Safari script behavior
- Subject: Re: need explanation for trivial Safari script behavior
- From: "Stockly, Ed" <email@hidden>
- Date: Fri, 15 Jul 2016 21:02:11 +0000
- Thread-topic: need explanation for trivial Safari script behavior
Try this:
tell application "Safari"
repeat with theWindow in the windows
log the name of theWindow as item
end repeat
end tell
The explanation is that when repeating through a list in that way, the local variable becomes a reference to the item in the list, rather than the item itself.
There is supposed to be a benefit in terms of speed, efficiency and memory allocation, but until you get used to it, it's just annoying.
ES
I am bewildered by the behavior of this most trivial Safari repeat.
tell application "Safari"
repeat with theWindow in the windows
log the name of theWindow
end repeat
end tell
What I get in the log is a long list of entries such as the following.
(*name of item 7 of every window*)
I am bewildered by the behavior of this most trivial Safari repeat.
tell application "Safari"
repeat with
theWindow in the windows
log the
name of
theWindow
end repeat
end tell
What I get in the log is a long list of entries such as the following.
(*name of item 7 of every window*)
|
_______________________________________________
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