<pre>function quoteLines string  -- convert text to a quoted string  put empty into quotedString  repeat with i = 1 to the number of lines in string    get line i of string    if it is empty then put "return" & return after quotedString    else if quote is not in it    then put quote & it & quote & " & return" & return after quotedString    else      put quote into expandString      put " & quote & " & quote into calcQuote      put number of chars in it into charCount      repeat with j = 1 to charCount        put char j of it into thisChar        put thisChar after expandString        if thisChar is quote then put calcQuote after expandString      end repeat      put expandString & quote & " & return" & return after quotedString      get " & " & quote & quote      repeat        put offset(it,quotedString) into emptyCat        if emptyCat is 0 then exit repeat        delete char emptyCat to emptyCat+length(it)-1 of quotedString      end repeat    end if  end repeat  return quotedStringend quoteLines</pre>