Custom depth mask + alpha output

Hi Everyone,

Is it possible to render out Alpha from the movie render window when using a custom depth mask?
The custom depth mask only shows the objects that I want to be rendered. The rest is all a solid color.
I tried myself but can’t seem to get it to work and don’t see any info about it online.

Thnx in advance.