Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

launch script eval(file.read()) palette or dialog

Participant ,
Mar 05, 2020 Mar 05, 2020

So I have two scripts. One that opens the other.

So I open this script.

var w = new Window("palette","script",undefined);

var btn = w.add("button",undefined,"Lauch");

var file = new File("<u+200e>~/Desktop/test.jsx");

btn.onClick = function(){
    if(!file.exists){
alert("WRONG LOCATIONS")        
        }
                   file.open("r");
                   eval(file.read());
                   file.close();
    }

w.show();

Nothing special. Then I click the button and it opens the below script.ton",un

var w = new Window("dialog","script",undefined);

var btn = w.add("button",undefined,"TEST");

w.show();e = new


Now if I use "dialog", works fine. If I change it to palette. Not fine...Anyone know why this is? And how I can use "palette".

TOPICS
Error or problem , Scripting , User interface or workspaces
675
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 05, 2020 Mar 05, 2020

Cannot really explain why, but this works:

var w = new Window("palette", "script", undefined);
var btn = w.add("button", undefined, "TEST");

w.onResizing = function() {
	this.layout.resize();
};

w.show();
Translate
LEGEND ,
Mar 05, 2020 Mar 05, 2020

Palettes have no hierarchy and exist all at the same level. I've seen it work somewhere, but likely it means writing a lot of code to have some global script running permanently managing both palettes, not like this. I'm sure some of the script gurus can explain it better.

 

Mylenium

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 05, 2020 Mar 05, 2020
LATEST

Cannot really explain why, but this works:

var w = new Window("palette", "script", undefined);
var btn = w.add("button", undefined, "TEST");

w.onResizing = function() {
	this.layout.resize();
};

w.show();
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines