> is it possible
> in Director, as in HyperCard, to export all of the scripts from a movie to a
> text file for study?
There are basically two main steps. First step would be to create a list of
members to save out. Second step is to go through the list saving out the
scriptText of the members collected previously.
Note that there is a nasty bug in FileIO Xtra which will crash Director is
you try repeating through a large list creating files. The alternative hack
is to use "setPref" which, unfortunately, will not allow you to specify a
directory path (In authoring mode, setPref will save the files to a folder
called "Prefs" in Director's folder).
Anyway, heres a basic example using setPref to create the file:
(example usage: ExportScripts("", #parent))
on ExportScripts pRequiredString, pScriptType
-- targetDirectory = getADirectoryPath()
ExportList = GetListOfMembersWithScripts(pRequiredString, pScriptType)
mx = ExportList.count
repeat with j = 1 to mx
memberToExport = ExportList[j]
memberScript = memberToExport.scriptText
exportFileName = "Script" & string(memberToExport.number) -- unique
exportFileName = exportFileName.char[1..27] & ".txt" -- Mac limit
setPref (exportFileName, memberScript)
end repeat
-- copyFiles(PrefDirectory, targetDirectory, ".txt")
alert "Created " & mx & " files in " & the applicationPath & "Prefs"
end
on GetListOfMembersWithScripts pRequiredString, pScriptType
if voidP(pRequiredString) then pRequiredString = EMPTY
rList = []
NumCasts = the number of castLibs
repeat with i = 1 to numCasts
NumMembers = the number of members of castLib i
repeat with j = 1 to NumMembers
scriptTxt = member(j,i).scriptText
if scriptTxt <> EMPTY then
if scriptTxt contains pRequiredString then
if voidP(pScriptType) then rList.append(member(j,i))
else if member(j,i).scriptType = pScriptType then
rList.append(member(j,i))
end if
end if
end if
end repeat
end repeat
return rList
end
Luke
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]