Hello, welcome to FIRST!
So just making sure, you're just asking about the logic? I program in C++ so I'm not sure about any of the specifics, but I'd imagine something like this would be a good start point, then add on more and more to it until you like it:
Code:
WindowMotor.Set(1.0);
while(LimitSwitch1.Get() == false)
{
}
WindowMotor.Set(-1.0);
while(LimitSwitch2.Get() == false)
{
}
WindowMotor.Set(0.0);
Now, a couple things you may want to look at is decreasing the speed, so that you don't break the limit switch

or having maybe a time for it to slow down so that you don't burn out the motors by immediately flipping it in reverse.
This is just the template logic, so try and mix it up and make it your own!