I have a script which outputs a text string to file (all working fine) - however, i want to try and output the file with the line endings converted to dos CRLF’s instead of just the regular mac LF’s.
This is the relevant part of the script, lifted straight from the applescript essential subroutines - i want to convert myArticleString:
–
set CRLF to ((ASCII character 13) & (ASCII character 10))
set LF to ASCII character 10
set myDosArticleString to replace_chars(myArticleString, LF, CRLF)
on replace_chars(this_text, search_string, replacement_string)
set AppleScript’s text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript’s text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript’s text item delimiters to “”
return this_text
end replace_chars
however, when the script is run, it simply errors on the replace_chars instruction (Finder got an error:Can’t continue replace_chars). If i nest the command in indesign’s tell block, the same error occurs.
Am i tackling this the right way? Is there a more simple way? Suggestions are gratefully received!
James