Brian Dailey preyed on victims in Edinburgh and Lanark, the high court in Edinburgh was told