Is it possible to have a script running a socket server in the background that can listen for and interact with InDesign based on the requests it receives without locking up InDesign? So you can still use it regularly while the socket server is listening. I have one now being set in a startup script but it locks up InDesign and you can't use it.
There are a few ways to get around it.
Another way would be, instead of using a while loop to listen for a connection is to use the onIdle event (Adobe InDesign CS5 (7.0) Object Model JS: IdleEvent)
A third way, that i have no idea but little hope that it would work (but if it does it would be the most simple one to implement): make sure the socket script is running in it's own target engine, and in the while loop use $.sleep() to give indesign the chance to react.