Text to Text

The most basic operation; copying from one longtext variable to another.

If the content of text[t1] is "abc", text[2] will have the same content "abc" after CopyText is executed:

GuiXT
// Using CopyText
CopyText fromText="t1" toText="t2"

// Analogous usage of Set
Set Text[t2] "&Text[t1]"

Using the -append option

text[t1]=Another text
text[t2]=A text.Another text

GuiXT
// Using CopyText
CopyText fromText="t1" toText="t2" -append

// Analogous usage of Set
Set Text[t2] "&Text[t2]&Text[t1]"
Variable to Text

Copying from a variable to a longtext.

text[var]=text
var=text

GuiXT
// Using CopyText
CopyText fromString="var" toText="var"

// Analogous usage of Set
Set Text[var] "&V[var]"

Copying from a variable to a TextBox.


var[textbox]=Initial text
var=Initial text

GuiXT
TextBox (1,1) (4,41) name="textbox"
CopyText fromString="var" toText="textbox"
Text to Variable

Copying from a longtext to a variable.

If the content of text[t1] is

line 1
line 2

then after CopyText is executed, the variable "var" will have the content "line 1", i.e. the first line of the source text since implicitely the option line=1 is added, if line= is not specified:

GuiXT
// Using CopyText
CopyText fromText="var" toString="var"

// This differs from transfer with Set, which transfers all lines:
Set V[var] "&Text[var]"
Structure to Text

Copying from a structure variable to a longtext.

struct={"tag": "Tag", "value": "Value"}
text[struct]=Tag
             Value

GuiXT
CreateStructure V[struct] tag value
Set V[struct.tag] "Tag"
Set V[struct.value] "Value"
CopyText fromStructure="V[struct]" toText="struct"
Text to Structure

Copying from a longtext to a structure variable.

struct={"tag": "Tag", "value": "Value"}
text[struct]=Tag
             Value

GuiXT
CreateStructure V[struct] tag value
CopyText fromText="struct" toStructure="V[struct]"
Table to Text

Copying from a table variable to a longtext.

tab=[{"tag": "Tag1", "value": "Value1"}, {"tag": "Tag2", "value": "Value2"}]
text[table]=Tag1
            Value1
            Tag2
            Value2

GuiXT
CreateStructure V[struct] tag value
CreateTable V[tab] include=V[struct]
Set V[tab.tag.1] "Tag1"
Set V[tab.value.1] "Value1"
Set V[tab.tag.2] "Tag2"
Set V[tab.value.2] "Value2"
CopyText fromTable="V[tab]" toText="table"
Text to Table

Copying from a longtext to a table variable.

tab=[{"tag": "Tag1", "value": "Value1"}, {"tag": "Tag2", "value": "Value2"}]
text[table]=Tag1
            Value1
            Tag2
            Value2

GuiXT
CreateStructure V[struct] tag value
CreateTable V[tab] include=V[struct]
CopyText fromText="table" toTable="V[tab]"