Reputation: 913
So I have script that creates a file in my Documents folder with a specific name. I want to later run the code more then once so I need to replace the old file. I tried to add a replace:true in the properties but it thinks replace is a variable.
tell application "Finder" to make file at (path to home folder) ¬
with properties {name:"textfile.txt",replace:true}
Upvotes: 0
Views: 210
Reputation: 285064
A workaround is to (try to) delete the file explicitly
set fileName to "textfile.txt"
tell application "Finder"
try
delete file fileName of home
end try
make file at home with properties {name:fileName}
end tell
Upvotes: 1