I’m trying to do a very simple thing — move (or duplicate) a file using JavaScript for Automation introduced with OS X Yosemite.
So far I have something like this.
finder = Application("Finder")
finder.move(Path("/Users/user/Source/file.pdf"), {
to: Path("/Users/user/Destination/file.pdf"),
replacing: true
})
The result is not great.
Error -1728: Can't get object.
Of course I can just use something like doShellScript("mv source destination")
but Finder + JAX solution seems to be better.