<pre>function writeScript sourceScript,varName  if varName is empty then put "scriptVar" into varName  put quoteLines(sourceScript) into resultScript  repeat with x = 1 to the number of lines in resultScript    put "put" & space before line x of resultScript    put space & "after" && varName after line x of resultScript  end repeat  put "put empty into" && varName & return before resultScript  return resultScriptend writeScript</pre>