Correct me if I’m wrong here, but I was pretty sure using the script communicator IS using the primary/secondary interface. It has functions for “setAsPrimary()” and “setAsSecondary().” Secondary is capable of running in parallel with the main robot program, it just can’t consume any robot time (no waits, moves, etc). Getting the variable value should be fine, provided it existed. Again, the program would have to be running for the secondary interface to do much. Near as I’ve found, you really can’t interact with variables using Java unless you’re just changing the value via normal script sending, or using variables you’ve created inside the script you send via the scriptCommunicators.
However, check this post: Possible to obtain the value of variable on dashboard server
In which a user claims to be able to read values of variables through the dashboard server. There’s another git repo out there somewhere that includes everything needed to launch the dashboard from Java, so maybe you could use these methods to get what you need? Extremely convoluted, and doesn’t seem like it should be that hard, but I think it is.