von dp am 23.August 98 um 18:33:09:
Good vs Evil (managing globals [enhanced])
From: Jakob Hede Madsen
(modifying a script by Peter Small)
property listOfGlobals
on new me
return me
end
on listGlobals me
set itemDelimOld = the itemDelimiter
set the itemDelimiter = ","
set listOfGlobals = []
set libCnt = the number of castLibs
Repeat with libNum = 1 to libCnt
set mbrCnt = the number of members of castLib libNum
Repeat with mbrNum = 1 to mbrCnt
set libMbr = member mbrNum of castLib libNum
-- if the type of libMbr #script then next repeat
set scriptStr = the scriptText of libMbr
if NOT(scriptStr contains "global") then next repeat
set lineCnt = the number of lines in scriptStr
repeat with lineNum = 1 to lineCnt
set lineStr = line 1 of scriptStr
delete line 1 of scriptStr
if NOT(word 1 of lineStr = "global") then next repeat
delete word 1 of lineStr
set itemCnt = the number of items in lineStr
repeat with itemNum = 1 to itemCnt
set itemNam = word 1 of item 1 of lineStr
delete item 1 of lineStr
if getPos(listOfGlobals, itemNam) then next repeat
set newFlag = TRUE
repeat with globNam in listOfGlobals
if globNam = itemNam then
set newFlag = FALSE
exit repeat
end if
end repeat
if NOT newFlag then next repeat
append listOfGlobals, itemNam
end repeat
end repeat
end repeat
end repeat
set the itemDelimiter = itemDelimOld
return(listOfGlobals) -- or use: put listOfGlobals
end
D. Plänitz