I have a script that writes to a bunch of text files one lilne at a time, sometimes these files can be pretty large (5-10Mb, 50-100k lines), it only runs by itself and the code is sequential in nature. Sometimes I get a "The process cannot access the file because it is being used by another process" - which I know only the running script is accessing the file - has anyone come across this before? Any solution? It's random as to what file and when is occurs, sometimes the script will run to completing and others not. Deleting the file and restarting the process doesn't seem to help when/if the issue occurs...
EDIT: I tried adding a 100ms delay after each "Write To Text File" action and it still fails. I'm thinking I might re-write the script and use either "String Concatenation" or "Append to Variable" and write the field once - does anyone know if this uses something like a StringBuilder object in .net, i.e. how effcient are these actions dealing with large amounts of data?
The Append to variable action just does that, in memory. Variables are actually variants which can be coerced to different types. String Concatenation just has a few different options but does basically the same thing. If you are writing small amounts to the file often it might be worth changing your project to build up the string in a variable and then just write when you are done. It will run faster that way too.
Thanks for the background info, incidentally I think I have found the culprit (not Automise). It seems like a backup util I use (JungleDisk) was the cause - even though the folder being written to was excluded from the backup job, it appears it was influencing it somehow… Sorry for the false alarm, as always, Automise is a great example of coding TJ