Re: preferred memory size
Re: preferred memory size
- Subject: Re: preferred memory size
- From: JollyRoger <email@hidden>
- Date: Sun, 20 Jan 2002 19:49:21 -0600
On 1/20/2002 10:52 AM, "Nicholas E. Baker" <email@hidden>
wrote:
>
hello all,
>
is it possible to set an application's preferred memory size via an
>
applescript?
Yep. Note that 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:
-- begin script
-- set ircle's memory partition to 5000 K
my SetPreferredMemorySize("prfC", 5120000)
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
if currentSize < numBytes then
-- change mem size
if majorFinderVersion < 8 then
-- before Mac OS 8, specify bytes
set total partition size of application file id
appCreator to (numBytes)
else
-- Mac OS 8+, specify kilobytes
set total partition size of application file id
appCreator to (numBytes div 1024)
end if
end if
end tell
on error errmsg number errnum
return ("SetPreferredMemorySize(" & appCreator & ", " & numBytes &
") = " & errnum & ": " & errmsg)
end try
end SetPreferredMemorySize
-- end script
Enjoy.
JR