I've just come up with a temporary solution. Replacing the alert with a prompt box with the path as the default text means I can copy it.
Replace:
alert(myPath);
with:
prompt("",myPath);
It's not as quick as I'd like since I have to right-click the text, select copy then close the prompt box. But it's the best solution I've got so far.