Page 1 of 1

change quotation mark in htmltext

Posted: Wed Aug 06, 2014 10:27 am
by chrisw
Hi,

can the quotation mark of a text be changed in the htmltext?
e.g. "All is gone" to "- All is gone -"

htmltext:
<p><font face="Shalom Old Style" size="20">"All is gone"</font></p>
to
<p><font face="Shalom Old Style" size="20"> - All is gone - </font></p>

The problem: deleting the quotation marks in the htmltext changes the font, size etc. too!

Kind regards

chrisw

Re: change quotation mark in htmltext

Posted: Wed Aug 06, 2014 12:53 pm
by Klaus
Hi Chris,

sorry, not sure I understand?
The quotes ARE in fact an important part of the HTML, so deleteing them will of course produce rubbish!

But your initial question is NOT about deleting quotes actually!?
e.g. "All is gone" to "- All is gone -"
Would result in:
<p><font face="Shalom Old Style" size="20">"- All is gone -"</font></p>

So you should just replace the TEXT inside of the quotes like this:
...
replace "All is gone" with "- All is gone -" in yourHTMLTextVariableHere
...

Best

Klaus

P.S.
Since this is everything but OFF-TOPIC (Hint, hint 8) ) I will move this thread to the beginners section.

Re: change quotation mark in htmltext

Posted: Fri Aug 08, 2014 3:30 pm
by MaxV
You should use replaceText() function and a good regular expression. :mrgreen:

Re: change quotation mark in htmltext

Posted: Sat Aug 09, 2014 8:58 am
by chrisw
MaxV, thanks for the hint. But alas I get a result only when I put

replaceText("Strafgericht","Straf","gut")

into the msg, but not, when I put it into the script (there I get always the message:

field "Field": execution error at line 2 (Handler: can't find handler) near "replaceText", char 1

How I get a result in the script?

Alle the best to You!

chrisw

Re: change quotation mark in htmltext

Posted: Thu Aug 14, 2014 1:35 pm
by MaxV
I don't have a whole picture of your problem, but I think that you have a field "mytext", so you may create a button with this code:

Code: Select all

on MouseUp
put the htmlText of field "myText" into temp
put "> " & quote into tStart
put replaceText(tStart,"> - ", temp) into temp
put  quote & " <" into tEnd
put replaceText(tEnd," - <", temp) into temp
#answer temp #uncomment this to see what happened
set the htmlText of field "mytext" to temp
end MouseUp  

Re: change quotation mark in htmltext

Posted: Thu Aug 14, 2014 1:40 pm
by Klaus
Hi Chris,
chrisw wrote:But alas I get a result only when I put: replaceText("Strafgericht","Straf","gut") into the msg, but not, when I put it into the script (there I get always the message:
field "Field": execution error at line 2 (Handler: can't find handler) near "replaceText", char 1
"replacetext()" is a FUNCTION, but you are obviously using it like a HANDLER!

Do something like this:
...
PUT replaceText("Strafgericht","Straf","gut") INTO aVariable
answer aVariable
# or whatever...
...

Best

Klaus

Re: change quotation mark in htmltext

Posted: Thu Aug 14, 2014 9:41 pm
by Da_Elf
found this this morning. i saw something about quotation marks in it but havent looked through all the stuff yet was just looking for a return/whitespace remover

http://www.robertcailliau.eu/Alphabetic ... 0Routines/