UR+Robotiq Screwdrivering solution

Answer a very similar question the other day.

And your problem looks exactly the same.

By the way I do think you should switch to the primary interface instead of the secondary one
https://www.universal-robots.com/articles/ur/interface-communication/overview-of-client-interfaces/

Kind Regards