• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Unloading Coercions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Unloading Coercions


  • Subject: Re: Unloading Coercions
  • From: Ehsan Saffari <email@hidden>
  • Date: Mon, 26 Mar 2001 14:35:15 -0600

Hi

Here's my attempt at detecting coercions, hope it's useful to some.
Needless to say, many contributions from this list made it possible.
Comments most welcom.

beware that some coercion codes are not as easily understandable as Jon's.

cheers
ehsan

--Coercion Extractor
--Requires Script Tools 2.0 from LNS <http://www.latenightsw.com>
--written by Ehsan Saffari <email@hidden> 25/3/2001
--Many thanks to R23, LNS
--Copies available coercions of the dropped folder/osax to the clipboard

property theTypes : {"osax", "osiz"} --resource types to check for
coercions
global crcnList
global outList

on open of fileList
set {crcnList, outList} to {{}, ""}
repeat with aFile in fileList
ProcessAFile(contents of aFile)
end repeat
my parseList(crcnList)
set {crcnList, outList} to {"", ""}
end open

to ScanAFolder(theFolder)
set fileNames to list folder theFolder without invisibles
repeat with aFile in fileNames
set theFile to (theFolder as string) & contents of aFile
ProcessAFile(alias theFile)
end repeat
end ScanAFolder

to ProcessAFile(aFile)
set theFileInfo to info for aFile
if folder of theFileInfo then
ScanAFolder(aFile)
else if file type of theFileInfo is "osax" then
set osaxName to name of theFileInfo
try
set resFileRef to openResourceFile aFile for reading
set availtypes to list1ResourceTypes resFileRef
if availtypes contains (item 1 of theTypes) then
set atype to (item 1 of theTypes)
else
set atype to (item 2 of theTypes)
end if
set numRsrc to count1Resources resFileRef of type atype
repeat with x from 1 to numRsrc
set theRsrc to get1IndexedResource resFileRef of type atype index x ,
as atype with reading data
set rn to resName of theRsrc
if rn begins with "CS" then
set end of crcnList to osaxName & "|" & resName of theRsrc
end if
end repeat
on error e number n
closeResourceFile resFileRef
display dialog e & n
end try
closeResourceFile resFileRef
end if
end ProcessAFile

to parseList(l)
repeat with i in crcnList
set j to offset of "|" in i
set outList to outList & text 1 thru (j - 1) of i & ": " & ,
text from (j + 5) to -5 in i & " -> " & text from (j + 9) to -1 in i &
return
end repeat
set the clipboard to outList
tell application "Finder" to open clipboard
end parseList

-->Jon9s Commands: scpt -> ****
-->Jon9s Commands: TEXT -> fss
-->Jon9s Commands: STXT -> fss
-->Jon9s Commands: itxt -> fss


  • Prev by Date: Selecting text from MacPERL Via AppleScript
  • Next by Date: RE: Why does posting messages take so long?
  • Previous by thread: Re: Unloading Coercions
  • Next by thread: Re: Unloading Coercions
  • Index(es):
    • Date
    • Thread