Re: Telling the Finder to only bring one window to the foreground
Re: Telling the Finder to only bring one window to the foreground
- Subject: Re: Telling the Finder to only bring one window to the foreground
- From: John M <email@hidden>
- Date: Tue, 18 Sep 2007 16:01:32 +0100
Hi,
This seems to work:
----
-- John Maisey -- 18 Sept 2007
tell application "Finder"
if (count of Finder windows) is not 0 then
-- If there is an open window.
set myURL to (URL of target of front window)
else if ((count of (get selection)) is not 0) then
-- Or a folder selected.
set myURL to (URL of item 1 of (get selection))
-- If not a folder or disk then set as default.
if item -1 of myURL is not "/" then set myURL to "file://localhost/"
else
-- Otherwise set a default value.
set myURL to "file://localhost/"
end if
end tell
-- Open the URL
open location myURL
----
It checks to see if there is an open window and shows the front one.
If there is no finder window it opens the first selected disk or
folder. Otherwise it opens the window of your local disk.
Using 'open location' on the URL of a folder or disk should have the
effect you want.
Hope this helps.
Best wishes
John Maisey
www.nhoj.co.uk
_______________________________________________
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