First, I would put an else after checking if the file exists. So the script doesn’t try to open the next script.
Then, I think(not by far sure) that what happens is that you declare the second window inside the button variable. So i think the scope is what makes you trouble. I thin dialog has direct scope to the main app or something(since you can;t have 2).
Long story short, if you declare your second window inside the main program, it works.
File 1 :
var w = new Window("palette", "script", undefined);
var w2 = new Window("palette", "script", undefined);
var btn = w.add("button", undefined, "Lauch");
var file = new File("‎~/Desktop/test.jsx");
btn.onClick = function () {
if (!file.exists) {
alert("WRONG LOCATIONS")
} else {
file.open("r");
eval(file.read());
file.close();
}
}
w.show();
File 2:
var btn = w2.add("button",undefined,"TEST");
w2.show();
Andrei
My Envato portfolio.