Window opener opens window again and again due to Void loop

It´s me again.
This might be viewed as OT but I figured it was not worth setting up another post for it.

As has been suggestet multiple times in the earlyer conversation, I plan on adding end switches or rather a kind of "home button" that would "zero" the position to home (Closed) during void setup().
So, basically it would read the button state and if the button state is LOW switch on the relais to run the motor until the button state is HIGH.
I read through the arduino reference loooking for a function that would work but neither the "do...while" nor the "switch...case" statements seemed to do what I want.

Im wondering what function to use here.