Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
mamafx
Topic Author
Posts: 2
Joined: Sat May 14, 2016 11:52 am

Dialog UI to palette

Sat May 14, 2016 7:54 pm

Hi everyone,
i'm very new to scripting. And i would like to make changes the script('file attaced') from dialog to palette which can be dock in my AE. But right now, when i change the source from dialog to palette, it does not work properly because it does not create a dockable UI. I think you understand my problem and help me out with it.

var w = new Window ('dialog {text: "Preferences", orientation: "column", alignChildren:["fill","fill"], properties: {closeButton: false}}');
w.main = w.add ('group {preferredSize: [600, 500], alignChildren: ["left","fill"]}');
w.stubs = w.main.add ('listbox', undefined, ['General', 'Interface', 'UI Scaling']);
w.stubs.preferredSize.width = 150;
w.tabGroup = w.main.add ('group {alignment: ["fill","fill"], orientation: "stack"}');
w.tabs = [];
w.tabs[0] = w.tabGroup.add ('group');
w.tabs[0].add ('statictext {text: "General"}');
w.tabs[0].add ('panel');
w.tabs[0].add ('checkbox {text: "Show Start workspace when no documents are open"}');
w.tabs[0].add ('checkbox {text: "Show Recent Files workspace when opening a file"}');
w.tabs[0].add ('panel {text: "Page numbering", preferredSize: [-1, 80]}');
w.tabs[0].add ('panel {text: "Font downloading and embedding", preferredSize: [-1, 80]}');
w.tabs[0].add ('panel {text: "Object editing", preferredSize: [-1, 150]}');
w.tabs[0].add ('panel {text: "When placing or pasting content", preferredSize: [-1, 80]}');
with (w.tabs[0]) {
with (add ('group {alignment: "center"}')) {
add ('button {text: "Reset al warning dialogs"}');
}
}
w.tabs[1] = w.tabGroup.add ('group');
w.tabs[1].add ('statictext {text: "Interface"}');
w.tabs[1].add ('panel {preferredSize: [-1, -10]}');
w.tabs[1].add ('panel {text: "Appearance", preferredSize: [-1, 80]}');
w.tabs[1].add ('panel {text: "Cursor and gesture options", preferredSize: [-1, 150]}');
w.tabs[1].add ('panel {text: "Panels", preferredSize: [-1, 150]}');
w.tabs[1].add ('panel {text: "Options", preferredSize: [-1, 100]}');
w.tabs[2] = w.tabGroup.add ('group');
w.tabs[2].add ('statictext {text: "UI Scaling"}');
w.tabs[2].add ('panel');
w.tabs[2].add ('panel {text: "Options", preferredSize: [-1, 200]}');
w.buttons = w.add ('group {alignment: "right"}');
w.buttons.add ('button {text: "OK"}');
w.buttons.add ('button {text: "Cancel"}');
for (var i = 0; i < w.tabs.length; i++) {
w.tabs[i].orientation = 'column';
w.tabs[i].alignChildren = 'fill';
w.tabs[i].alignment = ['fill','fill'];
w.tabs[i].visible = false;
}
w.stubs.onChange = showTab;
function showTab () {
if (w.stubs.selection !== null) {
for (var i = w.tabs.length-1; i >= 0; i--) {
w.tabs[i].visible = false;
}
w.tabs[w.stubs.selection.index].visible = true;
}
}
w.onShow = function () {
w.stubs.selection = 1;
showTab;
}
w.show()
 
beginUndoGroup
Posts: 77
Joined: Tue Nov 27, 2012 6:41 am

Re: Dialog UI to palette

Sun May 15, 2016 1:56 am

I may be mistaken, but from the name of the window you want to create it seems that it would be an auxiliary window for a main script.
If so, then it's not possible.
Dockable scripts are special in that the 'this' object at the entry point of the script is already a graphical container (empty panel), whereas for normal scripts it is the global object ($.global). This kind of dockable panels objects cannot be instantiated. You are given one at the beginning of the script and that's it.

To have your prefs window dockable, you'd have to create a separate script, also saved in the ScriptUI Panels folder (hence it would appear in the list of scripts under the Window tab, kind of annoying) then, to show/hide prefs, call it from your main script using a Menu Command (not $.evalFile), and the 2 scripts (main+prefs) should be able to communicate, may be through a prefs file somewhere on the disk. Never tried, but it looks clumsy, and not so much worth it, especially because of the prefs script appearing in the list of scripts.

Xavier
 
mamafx
Topic Author
Posts: 2
Joined: Sat May 14, 2016 11:52 am

Re: Dialog UI to palette

Sun May 15, 2016 5:02 am

Can you please make the necessary changes to make it possible.
 
beginUndoGroup
Posts: 77
Joined: Tue Nov 27, 2012 6:41 am

Re: Dialog UI to palette

Mon May 16, 2016 2:50 am

To make requests you can use this form: http://www.adobe.com/products/wishform.html

But i doubt that, in that very case, Adobe will change anything.

Who is online

Users browsing this forum: No registered users and 11 guests