Monitoring the USB data between the mouse and PC, interpreting the left button code, and triggering the solenoid driver circuit might be too much delay. That leaves two ways for your mouse to control both the solenoids and a program:
1. Part of the PC program is to output a bit to an external port such as a parallel printer port or a control line of a serial port. However, the PC you are using might not have either of these, and the later Windows versions do not support direct hardware interaction.
2. Open the mouse, pick off the signal from the left button, and run it outside the mouse to the solenoid driver circuit.
What is your skill set for either of these options?
Also, the circuit to drive the solenoids probably will be more complex than one transistor and one resistor each. Please post a schematic rather than a wiring diagram. To figure out the circuit details, a schematic conveys much more information.
ak