you need to determine if the device uses the AA batteries in series or in parallel. This determines the operational voltage of the device. Once you've done that you use either a voltage divider, a zener diode or a voltage regulator between the molex and the device to step down the 12v or 5v line to the required voltage. It may be possible to do it with a single resistor. I'm not sure how to calculate the value without further research.