Problems with speed & issues with coercion in OS 9.2.2 (AppleScript 1.7)
Problems with speed & issues with coercion in OS 9.2.2 (AppleScript 1.7)
- Subject: Problems with speed & issues with coercion in OS 9.2.2 (AppleScript 1.7)
- From: email@hidden
- Date: Sat, 26 Jan 2002 17:06:08 EST
Having finally managed to convince my local last mile provider to complete my
DSL connection change-over to a new ISP, I upgraded to OS 9.2.2 (from 9.2.1)
and found myself with AppleScript having been upgraded to 1.7.
This is fine and dandy, except that virtually all my personal scripts are
finder-based file manipulation scripts (moving cache files to the trash,
renaming files within folders); I found that a lot of coercion issues came
into play between whether file references are passed as strings or aliases
(where before they were effectively interchangeable). Not great, but I'll
live if I can figure out which calls require which datatype.
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.
Any help would be appreciated.
=-= Marc Glasgow