Re: Problems with speed & issues with coercion in OS 9.2.2
Re: Problems with speed & issues with coercion in OS 9.2.2
- Subject: Re: Problems with speed & issues with coercion in OS 9.2.2
- From: Kai Edwards <email@hidden>
- Date: Sun, 27 Jan 2002 03:23:51 +0100
>
From: email@hidden
>
Date: Sat, 26 Jan 2002 17:06:08 EST
>
Subject: Problems with speed & issues with coercion in OS 9.2.2
>
(AppleScript 1.7)
>
To: email@hidden
>
>
Meanwhile, on to the question: get info for (filereference_alias) and get
>
info for (filereference_string) is causing all sorts of odd problems. The
>
code in specific:
>
----------------+----------------+----------------+----------------+----------
>
>
------+
>
-- HANDLER b IsFolder
>
-- Purpose: Determines if the current file is a folder (returns boolean)
>
-- Expected Input: String or alias of path&filename
>
-- Returns Output: Boolean, TRUE or FALSE
>
-- Calls NO other handlers
>
----------------+----------------+----------------+----------------+----------
>
>
------+
>
local ValueForReturn -- boolean, Is path pointing at a folder?
>
local TheRecordContents -- record, the complete contents of the file record
>
>
on IsFolder(FullItemPathAndName)
>
>
set TheRecordContents to (get info for (FullItemPathAndName)) as list
>
-- item 7 in the list will be TRUE if it is a folder, FALSE if it is not
>
(boolean)
>
set ValueForReturn to (item 7 of (TheRecordContents)) as boolean
>
return ValueForReturn as boolean
>
>
end IsFolder
>
>
When I write it as a stand-alone script (rather than a handler), it takes in
>
the neighborhood of 12 seconds (on a G4/dual 800!) to get the info for
>
(FullItemPathAndName); as a handler, it freezes the computer, hard.
I can get a reasonable speed improvement from:
on IsFolder(FullItemPathAndName)
folder of (info for FullItemPathAndName)
end IsFolder
- or an even faster response from:
on IsFolder(FullItemPathAndName)
last text item of (FullItemPathAndName as string) = ":"
end IsFolder
However, I'm not running 9.2.2 at the moment. Do either of these improve
anything for you?
Kai
--
**********************************
Kai Edwards Creative Resources
1 Compton Avenue Brighton UK
Telephone +44 (0)1273 326810
**********************************