Thanks for your help, but when I connect the top two pins, from the picture, I just get sparking and the interior lights dim. From the picture, with the purple lines, it looks like you are connecting the all black wire pin with the Yellow/Red pin just to the right of it, as soon as I connect them, I get sparking and I have not even tried to connect the other pins yet. I tried to do them both at the same time, and I just get sparking from the top two pins. I am not sure I am fully understanding your description, but thanks for trying.
Here, I've numbered the switch pins and traces on the board:
Pin 1: Ground (black wire)
Pin 2: Motor out (Yellow/Red wire) = +12v: close
Pin 3: +12 V (thru trace)
Pin 4: +12V (red wire)
Pin 5: Motor out (Yellow/Black wire) = +12v: open
Pin 6: Ground (through trace on opposite side?)
Connecting 1-2 and 4-5 should be the "open the moonroof" position. Connecting 2-3 and 5-6 should be the "close the moonroof". That's what the switch does.
If you get spark as soon as you connect only 1-2 yourself, it may be that the insides of the switch has malfunctioned, stuck in the "2-3" position. Try shorting together just the 5-6 pins and see if the sunroof closes (or opens). Otherwise, there could be a wiring fault.
(If you unplug the switch at the harness connector, you can test the switch with a multimeter in the "ohms" position - though I doubt you have one, as a multimeter owner would also recognize how this kind of switch functions.)
If the switch is internally messed up and shorted, you'll need to unplug the console switch at the connector, and instead jumper harness pins/wires at the connector. There, the colors are different:
- At the harness, jumper black to yellow/red stripe, and then jumper light blue/black to red/yellow. That should close the moonroof.
- If instead it opens the moonroof (or does nothing), jumper black to red/yellow, and jumper lightblue/black to yellow/red.
If this procedure also makes sparks when just one of the two pairs are connected, you have a wiring fault (or possibly a fault in the relay module).
It may be possible to pry out the button from the front of the switch body, spreading the sides of the switch, and get all the little metal parts cleaned and re-assembled properly, but that would also take experience with rebuilding this kind of switch.
edit: (cleaned up post)