Nextion get values by page & component id w/o library

Hello guys,

I'm not using the library because for my application it would create so much unnessesary code i want to avoid. Im not copying my full procect here, because there are about 400 lines of code which aren't important for this issue.

I'm communicating with bare commands over serial.
On my nextion I have many pages with many textboxes. My goal is to get the .txt value from each textbox by page/ component id. When i use

get page0.textbox1.txt

I'm getting the value but with hundreds of textboxes on several pages, its simply stupid to declare all pages and boxes in my .ino file.

All commands i use are from the offical nextion Instruction-Set.
Here's some example code i've written:

#include <SoftwareSerial.h>

//for software serial
const int ssrx = 2;
const int sstx = 3;

SoftwareSerial ts(ssrx, sstx);

void setup() {

void loop() {
  sendToTS("get page0.textbox3.txt"); // works
  sendToTS("get 0.3.txt"); // doesn't work


void sendToTS(String msg){

My second aproach would be to send the corresponding text when I'm pressing the textbox. so the code on the nextion should be something like

printh SELF.txt

but unfortunatly it would only work if i convert the the text manually before i'll send it:

printh 6c 6f 72 65 6d 20 69 70 73 75 6d // sends "lorem ipsum" to arduino

unfortunatly I'm not finding a string to hex converting function in the nextions Instruction Set or I'm overlooking it.

Very thankful for every aproach.

I'm not exactly clear what the issue is with hundreds of textboxes... but you can certainly build the string on the fly to retrieve what you want.

char buffer[20];
byte pageNumber = 1;
byte tbNumber = 32;
sprintf( buffer, "get page%d.textbox%d.txt", pageNumber, tbNumber);

that would work if the pages and boxes would have similar names, but if e.g. the name of page 1 is "dogs"
and the names of textboxes like "Poodle", "German Sheppard", ...

that wouldn't work.