A bus driver has been banned from speaking to his wife for three years after bombarding her with jokes and pleas for sex by text message.
Mark MacFarlane, 43, was told he must not have any contact with his estranged wife Angela until June 2013.
Perth Sheriff Court heard MacFarlane, from Perth, sent her 670 text messages in just 19 days.
He was told to carry out 120 hours community service and made the subject of an anti-stalking order.
Sheriff Lindsay Foulis said he was "not to approach, contact or communicate with" Mrs MacFarlane.
The court was told MacFarlane had sent an average of one text every 45 minutes over a 19-day period.
The couple split up a year after getting married in October 2007, but got back together for a period in 2009.
Sheriff Foulis imposed the non-harassment order for three years and told MacFarlane: "I have absolutely no doubt the offence you admitted amounts to harassment.
"It would seem to me that a result of getting this constant bombardment of text messages would have a detrimental effect on anyone
"There comes a point when any human being says for goodness sake, give us peace."
Fiscal depute Charmaine Cole, who requested the rare anti-stalking order on behalf of the Crown, said: "The victim in this case requires protection."
MacFarlane said his wife was "a texter" who had shared thousands of messages a month with him during their marriage. He claimed he had been trying to woo her back by mobile phone.
He told the court: "We used to text in the region of 5,000 times a month to each other. Angela was a texter, she loved texting."
Solicitor David Holmes, defending, said the couple were now estranged with no prospect of a reconciliation and MacFarlane had no intention of contacting his wife again .