Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Close Window Script

Close Window Script
Thread Tools
Sotremolo
Guest
Status:
Reply With Quote
Jun 29, 2000, 11:39 PM
 
So I've posted this question once or twice at Resexcellence and no one ever gave any real anwser. See, I'm too lazy to hold down the damned option button while i'm flipping folder to folder. Just as option works, I'd like to know if I can just write or download an applescript to do this to all folders once another is activated. I've only gotten to being able to do those to one route; say harddrive to system folder. It seems that I would need to make a seperate script for each folder, which I just won't do. The whole "this_folder" tag isn't working for me either (though I'm probably going about that the wrong way). So I just want to know this and I'll be gleefully satisfied. I mean, does this need to be turned into an app or extension to automatically do this to every folder? My option button needs a rest.
     
numero
Junior Member
Join Date: Mar 2000
Location: Salem, OR, USA
Status: Offline
Reply With Quote
Jun 30, 2000, 01:18 AM
 
I don't have time to try this since I am getting married in two days.

I know this first part could be done easily.
Just thinking out loud I would say this is a job for folder action scripts. When the folder opens it closes its parent.

This second part sounds easy, but I have never tried it so I don't want to say for sure.
It would be a pain to have to set the folder action of each of your folders to the "close behind me" script. Could this assignment be scripted?

I am not at my own machine now and I won't be for about a week. I haven't tried any of this, but this is how I would start working on it.

-numero
     
lycaon
Forum Regular
Join Date: Mar 2000
Location: toronto, canada
Status: Offline
Reply With Quote
Jun 30, 2000, 01:24 AM
 
Code:
(* Save this as a stay-open applet. It will check every 5 seconds and close every container window excepting the frontmost. If you want more than one open, you'll have to quit this applet. *) on idle tell application "Finder" set x to container windows whose popup is false set c to count of x -- frontmost window will occur at beginning of list -- because it's sorted by index if c > 1 then close items 2 thru c of x end tell set x to {} return 5 -- seconds before next check end idle
Have fun!

p.s. numero, congratulations!

[This message has been edited by lycaon (edited 06-30-2000).]
     
RGS
Guest
Status:
Reply With Quote
Jul 1, 2000, 08:58 PM
 
Having an Applet idling just to close all windows other than the front is (IMO) excessive and will eventually create chaos. Why not a simple script under the OSA Menu or a script activated using a keyboard command using T-Minus Ten or similar?

-----

tell application "Finder"
activate
close (every window whose index is not 1)
end tell

--or--

tell application "Finder"
activate
close (every window whose index > 1)
end tell
     
lycaon
Forum Regular
Join Date: Mar 2000
Location: toronto, canada
Status: Offline
Reply With Quote
Jul 2, 2000, 12:24 AM
 
You could always remove the "on idle" wrapper. I do.

p.s. it only closes "container windows".

[This message has been edited by lycaon (edited 07-02-2000).]
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 10:37 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,