file.execute() not working for bat file
Dear all,
The purpose of my function copyToWinClipboard (text) is to get a string directly into the Windows Clipboard. The purpose is to allow the user of my project just to paste into the open-dialog of the application EndNote. I’m not certain whether the FM clipboard (supported by the copy/cut/paste methods for Doc) really fills into the Windows Clipboard also.
In the PhotoShop script forum I found the idea how to do this.
#target framemaker
// note the blank in the path
copyToWinClipboard ("E:\\_DDDprojects\\FM+EN escript\\FM-11-testfiles\\BibFM-collected.rtf");
function copyToWinClipboard (text) {
var theCmd, clipFile = new File(Folder.temp + "\\ClipBoardW.bat");
clipFile.open('w');
// theCmd = "echo \"" + text + "\" | clip"; // this doesn’t help either
theCmd = "echo " + text + " | clip";
clipFile.writeln (theCmd);
clipFile.close ();
clipFile.execute ();
}
Running this script provides a short flicker (the command prompt), but the clipboard does not contain the expected string. However, when double clicking on the generated I:\!_temp\ClipBoardW.bat the clipboard is filled correctly.
IMHO the execute method does not work correctly for bat files. In another area of my project-script i run an exe file with this method correctly.

