• 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: Unexpected Finder window (was: AppleScript-Users Digest, Vol 4, Issue 6)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unexpected Finder window (was: AppleScript-Users Digest, Vol 4, Issue 6)


  • Subject: Re: Unexpected Finder window (was: AppleScript-Users Digest, Vol 4, Issue 6)
  • From: kai <email@hidden>
  • Date: Wed, 3 Jan 2007 19:43:40 +0000


On 3 Jan 2007, at 18:40, Stockly, Ed wrote:

You see if I run this script on my mac, when there is NO Finder window open...

tell application "Finder"
	activate
	tell Finder window 1 to if exists then
		set current view to list view
		--do other stuff
	end if
end tell

Then the script actually opens a new window, but doesn't execute any of the other commands within the freaky tell/if block.

That behaviour certainly doesn't occur here.

A cursory glance at the event log reveals that the above translates (roughly) as:

----------------

tell application "Finder"
	activate
	if exists Finder window 1 then
		set current view of Finder window 1 to list view
		--do other stuff
	end if
end tell

----------------

Does the latter syntax produce a new window on your machine or not?

As I said before that's a pretty nifty construct, but I'm not sure how reliable it is and I certainly wouldn't recommend it for ordinary AppleScripters.

You may have missed Mr. N's comment on this but, since we're clearly now in repeat mode, let's replay a snippet:


However, the grammar allows any statement to follow the "to", so an "if" is perfectly valid...

The scripting style may not be to your taste, which is fine; don't use it and don't recommend it. However, the suggestion that you're getting strange behaviour from a mild syntactic variation does interest me.


Does anyone else get an unwanted window from any of this?

---
kai


_______________________________________________ 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/mailman//archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Unexpected Finder window (was: AppleScript-Users Digest, Vol 4, Issue 6)
      • From: "J. Stewart" <email@hidden>
    • Re: Unexpected Finder window
      • From: Axel Luttgens <email@hidden>
References: 
 >RE: AppleScript-Users Digest, Vol 4, Issue 6 (From: "Stockly, Ed" <email@hidden>)

  • Prev by Date: Re: Mail.app "reply" verb returning nothing
  • Next by Date: Re: Mail.app "reply" verb returning nothing
  • Previous by thread: RE: AppleScript-Users Digest, Vol 4, Issue 6
  • Next by thread: Re: Unexpected Finder window
  • Index(es):
    • Date
    • Thread