Re: Arranging a window?
Re: Arranging a window?
- Subject: Re: Arranging a window?
- From: Nigel Garvey <email@hidden>
- Date: Sat, 5 May 2001 11:20:48 +0100
Steve Herman wrote on Fri, 4 May 2001 14:00:01 -0500:
>
Problem 1: I open the content window of sourceFolder and get it's view, and
>
I open the content window of targetFolder and set it's view to match. Now,
>
if sourceFolder is in "icon" view or "small icon" view then I want to get
>
the positions of all the items in the sourceFolder and if those same items
>
exist in the targetFolder then set their position to match. But once I've
>
got sourceFolder's view I can't figure out what to compare it to to figure
>
out what it's value is. The old Finder Guide I've got says it should be a
>
value between 0 and 8, but it's not. In view that's returned comes back as
>
something like "icon" or "small" but they're not a strings, they appear to
>
be a constants (such as <<constant ****iimg>> when in icon view, or
>
<<constant ****smic>> in small icon view). So how do I compare my variable
>
to a constant of this sort?
The integer alternatives to the named 'view' settings are:
small: 0
icon: 1
name: 2
modification date: 3
size: 4
kind: 5
comment: 6
label: 7
version: 8
creation date: 9
large button: 15
small button: 16
You can use either form to *set* a window's view, but the integer form is
the only one that works in some cases, such as setting the 'view of every
window' to something. It also seems to be the only way to test the
current view of a window. (I believe this is something to do with the
compiler not knowing the right token to put in the script.)
It turns out that you can get the integer version of the current view
simply by coercing the returned value:
tell application "Finder"
set scw to open container window of folder src
set v to (view of scw) as integer -- coerce the 'view' to integer
if v is in {0, 1, 2, 15, 16} then
-- sort out the icon positions
end if
end tell
>
Problem 2: I also want to set the targetFolder's size to match the
>
sourceFolder's size. I've run into a situation where it appears that the
>
minimum size of a window on one machine is different from the minimum size
>
of a window on another machine.
Do you actually mean 'minimum size'? I think you may be after the
window's 'bounds'. Assuming that both machines have the same screen
resolution:
tell app "Finder"
set bounds of destw to bounds of scw
end
NG