Re: creator type of application file of every application process
Re: creator type of application file of every application process
- Subject: Re: creator type of application file of every application process
- From: "Arthur J Knapp" <email@hidden>
- Date: Sun, 22 Apr 2001 14:59:05 -0400
>
Date: Sat, 21 Apr 2001 16:03:47 -0400
>
From: "Marc K. Myers" <email@hidden>
>
Subject: creator type of application file of every application process
>
Under OS 8.1 (AS1.1.2), if I ask the Finder for "creator type of
>
application file of every application process" I get a list of creator types:
>
--> {"QkBg", "ttxt", "rasm", "Dock", "npdt", "MOSS", "ToyS", "FTCh"}
>
under OS 9.1 (AS1.6) and got an error. When I tested it I found that
>
what was being returned was:
>
--> {<<class QkBg>>, text returned, <<class rasm>>, <<class Dock>>,
>
<<class npdt>>, <<class MOSS>>, <<class ToyS>>, <<class FTCh>>}
This is an old bug, (one that appearently comes and goes with each new
version). Bill Cheeseman has documented this:
<
http://www.AppleScriptSourcebook.com/applescript/applescript112.html#newbug
s>
Bill Cheeseman:
>
Attempting to 'get creator type of every process' returns a list of
>
classes rather than a list of strings. [Joe Barwell reported this on
>
the MacScripting mail list on August 1, 1997, before it appeared on
>
the AppleScript site.] The same problem occurs when attempting to 'get
>
file type of every process'. It is not possible to work around this
>
bug by searching for the desired class. As with many of the Finder
>
scripting bugs, the only workaround is to build the desired list using
>
a slow repeat loop, as shown below. UNCHANGED IN FINDER 8.1.
>
I found that I could coerce it back to what I expected by using "as
>
text", but I'm curious about what I got without it. What do all those
>
classes mean and why does SimpleText return "text returned" instead of
>
it's creator type as a class?
The class of the label "text returned", from the record returned
from the Display Dialog command, happens to be the same as the creator
code of SimpleText, "ttxt". AppleScript is trying to do what it always
does, coerce AppleEvent codes into the AppleScript language.
Here's my solution:
-- I don't know which bytes are acceptable for use within
-- creator codes, but ascii 4 seems pretty unlikely.
--
set text item delimiters to ASCII character 4
tell application "Finder"
-- Get the codes with a direct string coercion:
--
set creatorList to ,
creator type of application file of ,
every application process as string
-- > "MSNMMOSSasDB"
end tell
set creatorList to every text item of creatorList
set text item delimiters to {""} -- restore
creatorList
-- > {"MSNM", "MOSS", "asDB"}
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.natural-innovations.com/as/
- Follow-Ups:
- iDo stable?
- From: "Serge Belleudy-d'Espinose" <email@hidden>