Is there faster way to remove \ from Mag-variable. After remove, script pastes that html to webform which postes it to webpage. Or is there a way to put html-code to variable without using \ before " somehow? Mag-variable is much longer in my script than in this example and it takes forever to remove.
set mag to “<p class="listitem">”
repeat with myChar in mag
set myNum to ASCII number of myChar
if myNum is 92 then set newString to newString & (ASCII character of myNum)
set mag to mag & (ASCII character of myNum)
end repeat
There are no backslashes in that string. The ones you see (and have to write) in Script Editor are just escape codes to show that the quotes that follow them are characters in the string. The backslashes don’t occur in the string itself. See what’s displayed when you run this:
set mag to "<p class=\"listitem\">"
display dialog mag
Any backslashes that do occur in a string will appear as “\” (ie. escaped backslashes) in Script Editor, and any code you write to remove them will have to use that convention.