[Closed] 2012 problem with createFile and fileIn
We have a script distribution/update system based on Aeron. It has worked perfectly for our use Max 8 or 9 up through 2011. But now in 2012, when it generates a macroscript using createfile, it doesn’t seem to release it so that the macro can be executed using fileIn.
The only thing that I’ve seen in the What’s New section in the help is that Macroscript loading is now multithreaded.
Has anyone had any similar issues with 2012?
The following works pre 2012:
mymacro = "macroscript testMacro
category:\"TestCategory\"
(for i =1 to symbolicPaths.numPaths() do
format \"\% : \%\
\" i (symbolicPaths.getPathName i))"
(
macroFileName = @"C: est.mcr"
macroFile = createFile macroFileName
if macroFile != undefined then
(
format myMacro to:(macroFile)
close macroFile
fileIn macroFileName
)
)
Yeah i had the same issue i thought i was loosing my mind also.
if you open another file it closes the original
So if you were editing test.txt and wanted to delete it you could open a new file test2.txt then the first may be deleted.
meanwhile use dotnet:
(dotnetclass "System.IO.File").WriteAllText <filename> <text_string>
Yeah… meanwhile rethink, rewrite my whole approach to script distribution.
Thanks for the DotNet tip.