This is an updated, working version of the original Automatic Coupler mod by GotLag. The bug where the train doesn't get set back to automatic mode has been fixed by Hopewell, as credited in this video by Xterminator. After that, these edits as proposed by bitbased have been applied.
All credit goes to GotLag for creating the original mod, Hopewell for fixing the automatic mode bug, and bitbased for making the mod compatible with 0.16.
As mentioned, I'm NOT the original author of this mod. I merely changed some things, following instructions from others, to get the mod working in 0.16. Sadly, I don't have the time to fully update / develop this mod, and implementing mod-compatibility etc. Please still report bugs in the discussions section, others may be able to fix them. If they do, please let me know, so I can implement the fix / improvement.
I would really like to see this functionality integrated into the Smarter Trains mod, which currently is incompatible with this mod. If you would like to help me get this functionality in Smarter Trains, please show this to the author by commenting in the discussion I opened, or the mod's forum topic.
How to use
Coupling or decoupling a train that has a line assigned through the Smarter Trains mod, will result in the train losing its line assignment.
I would like to make the mod more flexible (making coupling and decoupling possible while the train is at the station, not just when it arrives. Also, compatibility with the Smarter Trains mod would be great.
If the original author at any point wants to update his mod to the latest version of Factorio himself, and would like this fork of the mod to be decommissioned, please contact me.