Re: Minimizing non-Frontmost Windows
Re: Minimizing non-Frontmost Windows
- Subject: Re: Minimizing non-Frontmost Windows
- From: Irwin Poche <email@hidden>
- Date: Sat, 22 May 2004 09:15:57 -0500
On May 21, 2004, at 12:19 PM, Nigel Garvey wrote:
>
Irwin Poche wrote on Fri, 21 May 2004 07:42:48 -0500:
>
>
> On May 20, 2004, at 11:17 AM, Nigel Smith wrote:
>
>
>
>> ----------
>
>> tell application theApp
>
>> repeat with x from (count of windows) to 2 by -1
>
>> try
>
>> set miniaturized of window x to true
>
>> on error
>
>> set collapsed of window x to true
>
>> end try
>
>> end repeat
>
>> end tell
>
>> ----------
>
>
> True, that's simpler, but the real problem, why it doesn't work in the
>
> Finder, remains.
>
>
It doesn't work in any app on my system. 'Miniaturized' and 'collapsed'
>
are keywords of specific applications and will only compile in the
>
appropriately named 'tell' or 'using terms from' blocks.
>
>
The following seems to work for the Finder, Safari, and Script Editor,
>
and will probably work for any scriptable app that shares the same
>
property codes as Safari or the Finder:
>
>
tell application (path to frontmost application as string)
>
repeat with x from (count windows) to 2 by -1
>
try
>
using terms from application "Safari"
>
set miniaturized of window x to true
>
end using terms from
>
on error
>
using terms from application "Finder"
>
set collapsed of window x to true
>
end using terms from
>
end try
>
end repeat
>
end tell
>
>
However, if you run it from the Script menu, System Events will always
>
be
>
the frontmost application (unless this has changed in Panther). If you
>
really want this facility, it may be best to write a separate script
>
for
>
each application where you're likely to need it. This can be placed in
>
a
>
folder named after the application, in an "Applications" folder in your
>
"Scripts" folder. The appropriate script will then always be visible in
>
the Script menu whenever a particular application's frontmost.
>
>
NG
Thanks, Nigel, that works everywhere I've tried it (except of course
Word and Excel). I didn't understand the inconsistent color coding the
Script Editor was showing me on "collapsed" and "minimized" but it
becomes consistent when using the "using terms from."
The only other thing I found that was needed was to add a "if visible
of window x" least strange and unused windows with no apparent purpose
become minimized.
-Irwin
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.