Arranging a window?
Arranging a window?
- Subject: Arranging a window?
- From: Steve Herman <email@hidden>
- Date: Fri, 4 May 2001 14:00:01 -0500
I've run into a couple of interesting problems when trying to set a
window's view and the positions of the icons within. Basically I've got a
"sourceFolder" on a server volume and a "targetFolder" on a local volume.
Ultimately the sourceFolder will be arranged and maintained by an
administrator of sorts, and the script will run to make the targetFolder
which resides on many end-user machines look like the sourceFolder. So, I'm
trying to sort of mirror the sourceFolder's arrangement onto the
targetFolder.
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?
tell application "Finder"
set scw to open container window of folder src
set v to view of scw
if (v = icon) or (v = small) then <--- error here "Finder: can't get icon."
...
end if
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. I set the size of the sourceFolder on the
machine where it resides (it's as small as it will go vertically), then go
to a second machine, mount the volume containing sourceFolder and run my
script. The script correctly gets the size of the content window of the
sourceFolder, but when it attempts to set the size of the content window of
local targetFolder it fails with an "invalid size for object" error. It
appears that if I increase the size by a few pixels it will work OK. I
haven't been able to figure out if this difference in minimum sizes is due
to the monitor resolution or OS version or if it's some other setting that
I've overlooked. Has anyone seen this before who knows how to work around
it?
Steve
--
+------------------------------------------------+
| Steve Herman |
| OAO Corporation / NASA-ODIN |
| 102 Research Blvd, Bldg 2 |
| Madison, AL 35758 (voice) 256 730-2869 |
| email@hidden (fax) 256 730-2984 |
+------------------------------------------------+