Re: The Dictionary . . . Again
Posted: Thu Apr 17, 2025 9:33 am
Code sample window with colourisation.
Formatting code rejigged.
A forum for xTalk discussion
https://www.openxtalk.org/forum/
Code: Select all
on mouseUp
set the lockScreen to true
set the width of this stack to 44
set the height of this stack to 50
put the right of stack "revMenuBar" into LEFF
set the left of this stack to LEFF
put the top of stack "revMenuBar" into TOPP
set the top of this stack to TOPP
set the vis of me to false
set the vis of img "expand" to true
set the label of this stack to " "
send "mouseUp" to btn "bFORMAT"
set the lockScreen to false
end mouseUp
Code: Select all
on mouseUp
put empty into fld "DICK"
--set the lockScreen to true
put fld "sTERM" into searchO
set the text of fld "DICK" to the searchO of btn "DataSTORE"
---
put fld "DICK" into DICKON
set the itemDelimiter to "Examples:"
put item 1 of DICKON into PARTONE
delete item 1 of DICKON
set the itemDelimiter to "Description:"
put item 2 of DICKON into PARTTWO
delete item 2 of DICKON
put DICKON into fld "KODE"
_internal script colorize char 1 to (the number of chars of fld "KODE") of fld "KODE"
put empty into fld "DICK"
put PARTONE & cr after fld "DICK"
put "Description:" & cr & PARTTWO after fld "DICK"
--put 1 into DIX
--repeat until DIX > 500
--if word DIX of fld "DICK" contains "|" then
--put word DIX of fld "DICK" into SQUIG
--set the itemDelimiter to "|"
--put item 2 of SQUIG into SQUOG
--put SQUIG && SQUOG
--replace word DIX of fld "DICK" with SQUOG in fld "DICK"
--repeat for each item MAGIC in SQUOG
--put wordoffset(MAGIC , fld "DICK") into WITCH
--set the textColor of word WITCH of fld "DICK" to blue
--end repeat
--set the textStyle of word DIX of fld "DICK" to link
--end if
--add 1 to DIX
--end repeat
---
put the number of chars in fld "DICK" into GLYPHS
----
if fld "DICK" contains "(function)" then
replace "(function)" with (cr & numToCodePoint(1126) && "function" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "function"
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(1126) then
set the imageSource of char CYCLE of fld "DICK" to 1015
end if
add 1 to CYCLE
end repeat
end if
----
if fld "DICK" contains "(property)" then
replace "(property)" with (cr & numToCodePoint(1127) && "property" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "property"
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(1127) then
set the imageSource of char CYCLE of fld "DICK" to 1190
end if
add 1 to CYCLE
end repeat
end if
----
if fld "DICK" contains "(message)" then
replace "(message)" with (cr & numToCodePoint(1128) && "message" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "message"
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(1128) then
set the imageSource of char CYCLE of fld "DICK" to 1209
end if
add 1 to CYCLE
end repeat
end if
----
if fld "DICK" contains "(glossary)" then
replace "(glossary)" with (cr & numToCodePoint(1129) && "glossary" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "glossary"
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(1129) then
set the imageSource of char CYCLE of fld "DICK" to 1225
end if
add 1 to CYCLE
end repeat
end if
----
if fld "DICK" contains "(control structure)" then
replace "(control structure)" with (cr & numToCodePoint(1130) && "control structure" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "control"
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(1130) then
set the imageSource of char CYCLE of fld "DICK" to 1304
end if
add 1 to CYCLE
end repeat
end if
----
if fld "DICK" contains "(object)" then
replace "(object)" with (cr & numToCodePoint(1131) && "object" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "object"
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(1131) then
set the imageSource of char CYCLE of fld "DICK" to 1320
end if
add 1 to CYCLE
end repeat
end if
----
if fld "DICK" contains "(command)" then
replace "(command)" with (cr & numToCodePoint(1132) && "command" & cr) in fld "DICK"
set the caseSensitive to true
repeat for each item MAGIC in "command"
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(1132) then
set the imageSource of char CYCLE of fld "DICK" to 1363
end if
add 1 to CYCLE
end repeat
end if
----
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
----
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
----
----
if fld "DICK" contains "Syntax:" then
repeat for each item MAGIC in "Syntax:"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to green
end repeat
end if
----
if fld "DICK" contains "Synonyms:" then
repeat for each item MAGIC in "Synonyms:"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to blue
end repeat
end if
----
if fld "DICK" contains "----" then
repeat for each item MAGIC in "----"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to orange
end repeat
end if
----
if fld "DICK" contains "Params" then
repeat for each item MAGIC in "Params"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to purple
end repeat
end if
----
if fld "DICK" contains "Examples:" then
repeat for each item MAGIC in "Examples"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to red
end repeat
end if
----
if fld "DICK" contains "Description:" then
repeat for each item MAGIC in "Description"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to blue
end repeat
end if
----
if fld "DICK" contains "Values:" then
repeat for each item MAGIC in "Values"
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to orange
end repeat
end if
----
put the htmlText of field "DICK" into DICKY
replace "----" with "<font color=" & quote & "orange" & quote & ">----</font>" in DICKY
set the htmlText of fld "DICK" to DICKY
----
put word 1 of fld "DICK" into DUMA
if fld "DICK" contains DUMA then
repeat for each item MAGIC in DUMA
put wordoffset(MAGIC , fld "DICK") into WITCH
set the textColor of word WITCH of fld "DICK" to orange
set the textSize of word WITCH of fld "DICK" to 36
end repeat
end if
set the lockScreen to false
end mouseUp
Code: Select all
put the machine
Code: Select all
on mouseup
set itemDel to "/"
set the defaultfolder to item 1 to -2 of (the effective fileName of this stack)
put the date into XDATE
set the itemDelimiter to "/"
put item 1 of XDATE into X1
put item 2 of XDATE into X2
put item 3 of XDATE into X3
put X1 & "-" & X2 & "-" & X3 into XXX
put fld "DICK" into GUFF
put GUFF into url("file:" & fld "ZZZ" && XXX & ".txt")
end mouseup
Code: Select all
on mouseUp
set itemDel to "/"
set the defaultfolder to item 1 to -2 of (the effective fileName of this stack)
put the date into XDATE
set the itemDelimiter to "/"
replace "/" with "-" in XDATE
put fld "DICK" into GUFF
put GUFF into url("file:" & fld "ZZZ" && XDATE & ".txt")
end mouseUp