Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checking If A Finder Window Is Already Open



On 1/18/2007 9:24 PM, "Andrew Oliver" <email@hidden> wrote:

> 
> On Jan 18, 2007, at 9:12 PM, revDAVE wrote:
> 
>> Newbie help needed.....
>> 
>> Currently I have a small script:
>> 
>> tell application "Finder"
>>     activate
>> 
>> make new Finder window
>> set target of Finder window 1 to folder "thisone" of disk "drive1"
>> 
>> End tell
>> 
>> The problem is if I run it 2x then it opens 2 copies of the same
>> window ...
>> 
>> Is there a way to first check if that window is already open and
>> only open
>> it if it isn't already open?
> 
> Sure, ask the Finder:
> 
> tell application "Finder"
>      activate
>      if not (exists Finder window "thisone") then
>          make new Finder window
>          set target of Finder window 1 to folder "thisone" of disk
> "drive1"
>     end if
> end tell
> 
> Of course this check is crude - it would match any window called
> 'thisone", so if you're using a common folder name this test might not
> be sufficient, but you can add whatever check you're comfortable with.
> 
> Andrew
> :)
> 
> 


Thanks folks  - that worked great!

--
Thanks - RevDave
email@hidden
[db-lists]



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Checking If A Finder Window Is Already Open (From: Andrew Oliver <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.