And if ya go by the novels, Scotty gets back to Earth, becomes a host of a bar, and winds up in charge of Starfleet's Corps of Engineers before gettin' command of a Galaxy class starship.
It's fanficcy crap like this that makes me dislike the novels.
Well, the novels have used Scotty pretty randomly, and some of it was pretty dumb, but him bein' the fleet liaison between the Corps of Engineers and Starfleet Command admirals makes sense, all things considered.
The best way Scotty was put to use in the 24th century was in the S.C.E. series.