• 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 Finder behaviour...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange Finder behaviour...


  • Subject: Re: Strange Finder behaviour...
  • From: Philip Aker <email@hidden>
  • Date: Wed, 18 Jun 2008 10:42:24 -0700

On 08-06-18, at 08:35, David Crowe wrote:

The following behaviour seems strange to me:

tell application "Finder"
       set Window1Name to name of window 1
        repeat with aWindow in every window
        display dialog ">" & name of aWindow as string
        end repeat
end tell


The "display dialog" displays the name of a file in the Finder window, not the name of the Finder window.

On the second time through the repeat loop it generates an error saying "Finder got an error: Can't get name of item 2 of every window".

The following more cumbersome code operates correctly:

tell application "Finder"
       set Window1Name to name of window 1
     set i to 1
      repeat
          try
                     name of window i
                on error
                        exit repeat
             end try
                display dialog ">" & name of window i as string
                set i to i + 1
  end repeat      
end tell

Any explanations?

set res to {}
tell application "Finder"
repeat with w in (get every window)
set end of res to name of w
end repeat
end tell
res

Above, I use 'get' in the repeat clause. My explanation is that modern AppleScript increasingly uses Cocoa and it can't resolve things in some situations as well as a C or C++ implementation.

Maybe that's one of the hundreds of bugs that will be fixed in the "Snow Leopard" release.


Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

Democracy: Two wolves and a sheep voting on lunch.

 _______________________________________________
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 Finder behaviour... (From: David Crowe <email@hidden>)

  • Prev by Date: Re: Strange Finder behaviour...
  • Next by Date: Re: Strange Finder behaviour...
  • Previous by thread: Re: Strange Finder behaviour...
  • Next by thread: Re: Strange Finder behaviour...
  • Index(es):
    • Date
    • Thread