I recommend to take the tram which is closer to leaving the depot. When you pass the entire route and hover over the Yes button(the first time you can not make it, but then she will progibatsya). Also, you have to remember that this macro may interfere with the tram, so sometimes looking at the screen to make sure everything works well.
Download the program (Download) and go to the macro editor
press the button «Open file»
and select the downloaded file
assign a macro to a key and run the program