More than likely it’s not just a simple string that changes the PLC modes. I would assume that there are multiple messages (at least more than one) that the PLC would need to receive in order to change the PLC mode. And there’s a very good reason for this, consider that the comm port isn’t just use to communicate with DirectSoft, it’s also used to transmit/receive other messages be it Modbus, DirectNet, K-Sequence, ASCII. Granted these are different message protocols, but no matter the protocol the information being transmitted/received is just a bunch of bits. If changing the PLC mode was as simple as sending a simple string, then in all likely hood, AD would be receiving calls about their PLCs dropping out of Run mode and the reason would be that the message they sent to the PLC just so happened to match the same bit pattern that DirectSoft uses to change the PLC to Program mode.
There probably is a message to tell the PLC to enter some type of Edit/Program mode, which is used when connected with DirectSoft, in which the PLC would act upon another message that would change the PLC mode. So more than likely you would be looking at trying to figure out multiple messages that would need to be sent in order the change the PLC’s mode.
I have had something like this happen, although it didn’t affect the PLC. I was using leased line modems to transmit/receive data between (2) PLCs. Every few months the PLCs would lose communication with one another, it turned out that the leased line modems had reverted back to their factory default settings. I would reprogram the modems and everything started working again. The cause of the problem was that the modems were listening to the data being transmitted between the PLCs, and every so often a PLC message would just so happen to match the same bit pattern that the modem used to reset itself back to the factory default settings. I reprogrammed the modems to ignore all communication after 10 seconds and never had that problem again.