Re: Set application preferred memory size (was Re: (no subject))
Re: Set application preferred memory size (was Re: (no subject))
- Subject: Re: Set application preferred memory size (was Re: (no subject))
- From: JollyRoger <email@hidden>
- Date: Tue, 05 Feb 2002 07:30:53 -0600
On 2/4/2002 4:12 PM, "Michelle Steiner" <email@hidden> wrote:
>
On 2/4/02 2:47 PM, Grams, Mike J. (CGC) <email@hidden> wrote:
>
>
> Can I set the Preferred Memory size of Applications (Illustrator, Photoshop,
>
> ect...) on my Mac using Applescript??? Any examples??
>
(snip)
>
>
You must set the partition size before setting the minimum size, and the
>
minimum size can't exceed the partition size. Also, the number is in
>
kilobytes, so the "400" in the above example sets the partition to 400K
>
bytes.
Actually, the pre-Mac OS 8 Finder expects the size in *bytes*, while
the Mac OS 8+ Finder expects the size in *kilobytes*.
I use the following handler to set the preferred memory size in my scripts.
To call it, supply the 4-character creator code of the app you want to
resize, and the size, in bytes, you want to set it to, like so:
-- this sets Photoshop's memory partition to 80 megabytes
my SetPreferredMemorySize("8BIM", 81920000)
-- begin script
on SetPreferredMemorySize(appCreator, numBytes)
try
tell application "Finder"
set finderVersion to version
set majorFinderVersion to the first character of finderVersion
set currentSize to total partition size of application file id
appCreator
-- change mem size
if majorFinderVersion < 8 then
-- before Mac OS 8, you specify bytes
set total partition size of application file id appCreator
to (numBytes)
else
-- Mac OS 8 and after, you specify the number of kilobytes
set total partition size of application file id appCreator
to (numBytes div 1024)
end if
end tell
on error errmsg number errnum
return ("SetPreferredMemorySize(" & appCreator & ", " & numBytes &
") = " & errnum & ": " & errmsg)
end try
end SetPreferredMemorySize
-- end script
Enjoy.
PS: Mike, I answered this question here on the list on 1/20/2002. Next
time, before you ask, you may want to consider trying a search for the topic
on this web page <
http://lists.apple.com/search/>, or by browsing the
archives on this web page
<
http://lists.apple.com/mhonarc/applescript-users/> (username and password
are "archives". A lot of times, it's fairly easy to find the answer to
your question without generating list traffic.
JR