Two things I noticed in a simple Finder script
Two things I noticed in a simple Finder script
- Subject: Two things I noticed in a simple Finder script
- From: Jan Pieter Kunst <email@hidden>
- Date: Sat, 02 Jun 2001 17:47:01 +0200
Hello all,
I have two windows with frequently accessed aliases opened as pop-up windows
at the bottom of my screen. A problem with this is that applications that
change the screen resulotion (Quake III for example) cause these pop-up
windows to change to normal windows.
I wrote a script to clean up my desktop after a screen resolution change
(icons back in their places, application switcher to the right upper corner,
and the two folders back as tabbed windows). I noticed that it is not
possible to script the exact position of the folder tabs at the bottom of
the screen. I can do this:
set x to container window of folder ...
set popup of x to true
set pulled open of x to false
and I can even 'get' the position of a tabbed window, but I can't 'set' it.
I get an error message that the window has to be a normal open window to
'set' its position. The folder tabs appear lined up to the left of the
screen by default, and I can slide them to the middle manually, but I can't
script them to appear in the middle.
Another thing I noticed is that if there are no windows open, I can't use
Applescript to check if a certain window is open without getting into some
infinite loop. In other words, this:
set x to container window of folder ...
set y to container windows -- gives {} if there are no open windows
if y contains x then ... -- script gets stuck in an infinite loop if y = {}
doesn't work if there are no Finder windows open.
However, if there is any Finder window open, it doesn't matter if it's the
one I'm checking for or any other, then the above code executes without
problem. So I had to build in an extra step to check for emptyness of the
list of open windows first, like this:
set x to container window of folder ...
set y to container windows
if y = {} then
-- do stuff without checking if there is anything contained in y
else
if y contains x then
-- do stuff
end if
end if
Any ideas what could be the cause of the infinite loop thing?
Thanks,
Jan Pieter Kunst.-