Throw me a frikkin bone
Forum rules
Be kind.
Be kind.
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Throw me a frikkin bone
Why is this NOT replacing every 'ѧ' with an image?
-
-
https://richmondmathewson.owlstown.net/
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Throw me a frikkin bone
Obviously too much to expect someone to help.
-
-
https://richmondmathewson.owlstown.net/
- OpenXTalkPaul
- Posts: 2836
- Joined: Sat Sep 11, 2021 4:19 pm
- Contact:
Re: Throw me a frikkin bone
That's more like a work around, 'replace' should replace every occurrence of your target unicode character in the field without that repeat loop.richmond62 wrote: ↑Sat Apr 19, 2025 1:00 pm Obviously too much to expect someone to help.
-
Screenshot 2025-04-19 at 15.58.28.jpg
Maybe try the newer form of 'replace', which is 'replace-in-feild' like so:
replace "Needle" with "Haystack" in field X preserving styles
Maybe that can handle the unicode better? It has a separate entry in the dictionary that says it was added in v7 (the other 'replace' entry say it was added in 1.0)
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Throw me a frikkin bone
Certainly worth a try . . . in due course . . . when I'm free . . .
Off to change the tyres on our car: seasonal requirement here in Bulgaria: what a ^&*()$#.
Off to change the tyres on our car: seasonal requirement here in Bulgaria: what a ^&*()$#.
https://richmondmathewson.owlstown.net/
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Throw me a frikkin bone
Reading a bit more closely: that suggestion, Paul, is NOT going to solve the problem, as OXT Lite has NO problem at all showing Unicode characters inwith a text field.
The problem is 'beyond' that insofar that I bung unicode place marker characters in various locations in the text inwith a text field, and then replace them with images like this:
What this DOES do is replace every instance of numToCodePoint(1133) with the image numbered 1365 and colour every instance of 'constant' red (as it should).
The PROBLEM is when this script runs:
it replaces every instance of numToCodePoint(1134) with the image numbered 1369 and colour every instance of 'constant' red (as it should); BUT also removes all the instances of image number 1365 and set every instance of 'constant' back to black.
The problem is 'beyond' that insofar that I bung unicode place marker characters in various locations in the text inwith a text field, and then replace them with images like this:
Code: Select all
if fld "DICK" contains "(constant)" then
replace "(constant)" with (cr & numToCodePoint(1133) && "constant" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "constant"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to red
end repeat
put 1 into CYCLE
repeat until CYCLE > GLYPHS
if char CYCLE of fld "DICK" = numToCodePoint(1133) then
set the imageSource of char CYCLE of fld "DICK" to 1365
end if
add 1 to CYCLE
end repeat
end if
The PROBLEM is when this script runs:
Code: Select all
if fld "DICK" contains "(keyword)" then
replace "(keyword)" with (cr & numToCodePoint(1134) && "keyword" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "keyword"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to red
end repeat
put 1 into CYCLE
repeat until CYCLE > GLYPHS
if char CYCLE of fld "DICK" = numToCodePoint(1134) then
set the imageSource of char CYCLE of fld "DICK" to 1369
end if
add 1 to CYCLE
end repeat
end if
https://richmondmathewson.owlstown.net/
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Throw me a frikkin bone
To contextualise things further here is a stack that makes this explicitly clear:
- -
This code SHOULD:
1. Bung a 'Ch' image in front of each occurrence of the word 'cheese'.
2. Colour each occurrence of the word 'cheese' red.
3. Bung an 'F' image in front of each occurrence of the word 'fan'.
4. Colour each occurrence of the word 'fan' purple.
It does DO #1 (you can see this IF you put a wait in the code in the button ('Fromage Dure'); but the code for #3 and wipes the 'Ch' images out and reverts to the unicode place marker characters.
It ONLY manages to colour the first occurrence of 'cheese' red (#2), which is subsequently wiped out when the code ONLY manages to colour the first occurrence of 'fan' purple.
So, the whole shebang is not fit for purpose.
- -
Code: Select all
on mouseup
if fld "GUFF" contains "cheese" then
replace "cheese" with (numToCodePoint(1127) && "cheese") in fld "GUFF"
set the caseSensitive to true
repeat for each item MAGIC in "cheese"
put wordoffset(MAGIC , fld "GUFF") into WITCH
set the textColor of word WITCH of fld "GUFF" to red
end repeat
put 1 into CYCLE
repeat until CYCLE > 1000
if char CYCLE of fld "GUFF" = numToCodePoint(1127) then
set the imageSource of char CYCLE of fld "GUFF" to 1007
end if
add 1 to CYCLE
end repeat
end if
----
if fld "GUFF" contains "fan" then
replace "fan" with (numToCodePoint(1128) && "fan") in fld "GUFF"
set the caseSensitive to true
repeat for each item MAGIC in "fan"
put wordoffset(MAGIC , fld "GUFF") into WITCH
set the textColor of word WITCH of fld "GUFF" to purple
end repeat
put 1 into CYCLE
repeat until CYCLE > 1000
if char CYCLE of fld "GUFF" = numToCodePoint(1128) then
set the imageSource of char CYCLE of fld "GUFF" to 1011
end if
add 1 to CYCLE
end repeat
end if
end mouseup
1. Bung a 'Ch' image in front of each occurrence of the word 'cheese'.
2. Colour each occurrence of the word 'cheese' red.
3. Bung an 'F' image in front of each occurrence of the word 'fan'.
4. Colour each occurrence of the word 'fan' purple.
It does DO #1 (you can see this IF you put a wait in the code in the button ('Fromage Dure'); but the code for #3 and wipes the 'Ch' images out and reverts to the unicode place marker characters.
It ONLY manages to colour the first occurrence of 'cheese' red (#2), which is subsequently wiped out when the code ONLY manages to colour the first occurrence of 'fan' purple.
So, the whole shebang is not fit for purpose.
https://richmondmathewson.owlstown.net/
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Throw me a frikkin bone
And this is a load of cobblers:
-
-
https://richmondmathewson.owlstown.net/
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Throw me a frikkin bone
Of course THIS works (re colourisation):
-
-
Whether one can, subsequently, insert images has yet to be seen.
Code: Select all
on mouseup
put the htmlText of fld "GUFF" into GUPH
replace "cheese" with "<font color=" & quote & "red" & quote & ">cheese</font>" in GUPH
replace "fan" with "<font color=" & quote & "purple" & quote & ">fan</font>" in GUPH
set the htmlText of fld "GUFF" to GUPH
end mouseup
Whether one can, subsequently, insert images has yet to be seen.
https://richmondmathewson.owlstown.net/
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Throw me a frikkin bone
Well, THIS worked:
-
-
A really bad case of:
-
Code: Select all
on mouseup
if fld "GUFF" contains "cheese" then
replace "cheese" with (numToCodePoint(1127) && "cheese") in fld "GUFF"
end if
if fld "GUFF" contains "fan" then
replace "fan" with (numToCodePoint(1128) && "fan") in fld "GUFF"
end if
put the htmlText of fld "GUFF" into GUPH
replace "cheese" with "<font color=" & quote & "red" & quote & ">cheese</font>" in GUPH
replace "fan" with "<font color=" & quote & "purple" & quote & ">fan</font>" in GUPH
set the htmlText of fld "GUFF" to GUPH
end mouseup
A really bad case of:
-
https://richmondmathewson.owlstown.net/
- richmond62
- Posts: 5288
- Joined: Sun Sep 12, 2021 11:03 am
- Location: Bulgaria
- Contact:
Re: Throw me a frikkin bone
Cripes:
https://youtu.be/QbdCpi4qTNY
-
https://youtu.be/QbdCpi4qTNY
Code: Select all
on mouseup
if fld "GUFF" contains "cheese" then
replace "cheese" with (numToCodePoint(1127) && "cheese") in fld "GUFF"
end if
if fld "GUFF" contains "fan" then
replace "fan" with (numToCodePoint(1128) && "fan") in fld "GUFF"
end if
----
put the htmlText of fld "GUFF" into GUPH
replace "cheese" with "<font color=" & quote & "red" & quote & ">cheese</font>" in GUPH
replace "fan" with "<font color=" & quote & "purple" & quote & ">fan</font>" in GUPH
set the htmlText of fld "GUFF" to GUPH
----
put the number of chars in fld "GUFF" into GNUM
put 1 into CYCLE
repeat until CYCLE > GNUM
if char CYCLE of fld "GUFF" = numToCodePoint(1127) then
set the imageSource of char CYCLE of fld "GUFF" to 1007
end if
if char CYCLE of fld "GUFF" = numToCodePoint(1128) then
set the imageSource of char CYCLE of fld "GUFF" to 1011
end if
add 1 to CYCLE
end repeat
end mouseup
- Attachments
-
- Picture This.oxtstack
- (4.85 KiB) Downloaded 35 times
https://richmondmathewson.owlstown.net/
Who is online
Users browsing this forum: No registered users and 7 guests