how to modify the string through send command. Forum Home › Forums › Understanding the Software › how to modify the string through send command. This topic has 4 replies, 3 voices, and was last updated 1 month, 2 weeks ago by Mikhail. Viewing 5 posts - 1 through 5 (of 5 total) Author Posts February 27, 2025 at 9:11 am #16203 38368423Participant The data type of the output channel is ASCII string, how to modify the string through send command. February 27, 2025 at 9:16 am #16204 manjey73Participant You need to process CmdDataStr in the output formula February 27, 2025 at 10:41 am #16208 MikhailModerator Add the following function in the Scripts table: public byte[] SetStr() { string s; if (CmdData == null) s = "null"; else s = Encoding.UTF8.GetString(CmdData); SetData(CnlNum, EncodeAscii(s), 1); return CmdData; } Set the output formula of the channel to SetStr() It works for a channel of the data length = 1 (or empty) February 27, 2025 at 11:47 am #16210 38368423Participant length of string is great than 24 February 28, 2025 at 10:43 am #16212 MikhailModerator The function below takes a data length into account for Unicode strings. public byte[] SetUnicode() { if (ArrIdx == 0) { string s = CmdData == null ? "null" : Encoding.UTF8.GetString(CmdData); int dataSize = Channel.DataLen ?? 1; for (int i = 0; i < dataSize; i++) { string part = Substring(s, i * 4, 4); SetData(CnlNum + i, EncodeUnicode(part), 1); } } return CmdData; } Author Posts Viewing 5 posts - 1 through 5 (of 5 total) You must be logged in to reply to this topic. Log In Username: Password: Keep me signed in Log In