HyperCard: Handler for Writing Scripts (7/92)

This function takes a script as a parameter and returns a script that can
reproduce the original script. It's useful for encoding scripts into other
scripts.

function writeScript sourceScript,varName

if varName is empty then put "scriptVar" into varName
put quoteLines(sourceScript) into resultScript
repeat with i = 1 to the number of lines in resultScript
put "put " before line i of resultScript
put " after " & varName after line i of resultScript
end repeat
put "put empty into " & varName & return before resultScript
return resultScript
end writeScript


This article is adapted from the Claris Tech Info database.
Published Date: Feb 19, 2012