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.orientation = 'column';
w.tabs.alignChildren = 'fill';
w.tabs.alignment = ['fill','fill'];
w.tabs.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.visible = false;
}
w.tabs[w.stubs.selection.index].visible = true;
}
}
w.onShow = function () {
w.stubs.selection = 1;
showTab;
}
w.show()
Dialog UI to palette
Moderator: Paul Tuersley
-
- Posts: 81
- Joined: November 27th, 2012, 6:41 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
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
-
- Posts: 81
- Joined: November 27th, 2012, 6:41 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.
But i doubt that, in that very case, Adobe will change anything.