Author Topic: Question about read,close,remove fileIO  (Read 171 times)

Can someone tell me how to read file and at the end close it and remove. Becouse if i create one button with something like this:

var test = alg.fileIO.open(expP + "/projectSettings.txt").readAll()
alg.fileIO.open(expP + "/projectSettings.txt").close()
alg.fileIO.open(expP + "/projectSettings.txt").remove()
i get Script 135 FileIOError: Cant remove file

but if i create two buttons in one i read file on second close and remove then it works.

What is the point of calling alg.fileIO.open() three times in a row in your example ? This function returns a file handle.
You should use instead:
Code: [Select]
var test = alg.fileIO.open(expP + "/projectSettings.txt")
var content = test.readAll()
test.close()
test.remove()
Don't forget your log file. It can be exported from the Help menu of the software.
-----------
Fabrice Piquet aka Froyok. Product Manager, Technical Artist and Documentation at Adobe.