A solution could be (if isn't too complicated in your case) to use an event structure.
Unfortunately this approach has its flaws...see the little vi attached.
One issue with your VI appears when you paste text into the string
control. That way there's a risk that the limit might be exceeded.
Check out other threads that does take that case into account, for
example this one: