我正在 TDI 中开发自定义脚本。该脚本根据返回的数组发送电子邮件。
发送电子邮件时,我使用函数 system.openFileForOutput
打开一个文件
然后我写下当前的电子邮件号码(1、2、3 等)。
然后我关闭system.openFileForOutput
。
因此,如果我在脚本到达关闭语句之前将其停止,文件将变为空,并且我不知道电子邮件在哪里停止。
我需要一些建议。如何保存脚本所在的电子邮件#而不丢失位置?
最佳答案
写入内容后可以立即关闭文件。然后在您想要再次关闭时打开它。
--打开新文件并写入
var file = "D:\\dump.txt";
var outfile = system.openFileForOutput(file);
outfile.newLine ();
outfile.write("Report")
outfile.newLine ();
outfile.close ();
--将内容附加到之前创建的文件
var file = "D:\\dump.txt";
var outfile = system.openFileForAppend(file);
outfile.newLine ();
outfile.write("Report")
outfile.newLine ();
outfile.close ();
还有一些 Google 小组针对 TDI 相关疑问。 https://groups.google.com/forum/#!forum/ibm.software.network.directory-integrator
关于java - TDI/Java-JavaScript System.openFileForOutput,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17413795/