Copy link to clipboard
Copied
i made a simple after effects script, and i want to know how to turn it to a dockable script...
when i put it in the scriptsUI folder it just shows me 2 screens...
here is the script:
//UI Creation
var myWindow = new Window("palette");
var myMessage = myWindow.add("statictext");
myMessage.text = "תסריט להפיכת טקסט. נעשה על ידי איתי אסולין";
var buttons = myWindow.add("panel", undefined, "buttons");
var HebrewThis = buttons.add("button", undefined, "HebrewThis!");
var Cancel = buttons.add("button", undefined, "Cancel");
buttons.orientation = "row";
//UI Creation End.//
//Function creations
//Hebrew this button
HebrewThis.onClick = function(){
app.beginUndoGroup("AddEffect");
var curItem = app.project.activeItem;
var selectedLayers = curItem.selectedLayers;
// check if comp is selected
if (curItem == null || !(curItem instanceof CompItem)){
// if no comp selected, display an alert
alert("בבקשה בחר שכבה");
} else {
// define the layer in the loop we're currently looking at
var myLayer = app.project.activeItem.layer(1);
var curVal = myLayer.property("Scale").value;
myLayer.property("Scale").setValue([-100, 100]);
var Text = selectedLayers[0].Text.Animators.addProperty("ADBE Text Animator");
myText.property("ADBE Text Selectors").addProperty("ADBE Text Selector");
myText.property("ADBE Text Animator Properties").addProperty("ADBE Text Scale 3D").setValue([-100, 100]);
}
// close the undo group
app.endUndoGroup();
}
//Hebrew this button ended.
//cancel button
Cancel.onClick = function(){
app.beginUndoGroup("AddEffect");
var curItem = app.project.activeItem;
var selectedLayers = curItem.selectedLayers;
// check if comp is selected
if (curItem == null || !(curItem instanceof CompItem)){
// if no comp selected, display an alert
alert("בבקשה בחר שכבה");
} else {
// define the layer in the loop we're currently looking at
var myLayer = app.project.activeItem.layer(1);
var curVal = myLayer.property("Scale").value;
myLayer.property("Scale").setValue([100, 100]);
var myAnim = selectedLayers[0].Text.Animators.property("ADBE Text Animator");
myAnim.property("ADBE Text Selectors").property("ADBE Text Selector");
myAnim.property("ADBE Text Animator Properties").property("ADBE Text Scale 3D").setValue([100, 100]);
}
// close the undo group
app.endUndoGroup();
}
.show();
-=
Oh, Im sorry. Had to fix one line in the code. My bad.
...(function(thisObj) {
var scriptPalette = scriptBuildUI(thisObj);
if (scriptPalette !== null && scriptPalette instanceof Window) {
scriptPalette.center();
scriptPalette.show();
} else {
scriptPalette.layout.layout(true);
}
function scriptBuildUI(thisObj) {
//UI Creation
var myWindow = (thisObj instanceof Panel) ? thisObj : new Window("palette", prefs.script.name, undefined, {
resi
Copy link to clipboard
Copied
Hi.
The magic in having script as a dock-able panel is to pass this to a function.
I took a liberty to refactor your code a bit, but I think you will figure it out.
Cheers.
(function(thisObj) {
var scriptPalette = scriptBuildUI(thisObj);
if (scriptPalette !== null && scriptPalette instanceof Window) {
scriptPalette.center();
scriptPalette.show();
} else {
scriptPalette.layout.layout(true);
}
function scriptBuildUI(thisObj) {
//UI Creation
var myWindow = new Window("palette");
var myMessage = myWindow.add("statictext");
myMessage.text = "תסריט להפיכת טקסט. נעשה על ידי איתי אסולין";
var buttons = myWindow.add("panel", undefined, "buttons");
buttons.orientation = "row";
var HebrewThis = buttons.add("button", undefined, "HebrewThis!");
var Cancel = buttons.add("button", undefined, "Cancel");
//Hebrew this button
HebrewThis.onClick = function() {
app.beginUndoGroup("AddEffect");
var curItem = app.project.activeItem;
var selectedLayers = curItem.selectedLayers;
// check if comp is selected
if (curItem == null || !(curItem instanceof CompItem)) {
// if no comp selected, display an alert
alert("בבקשה בחר שכבה");
} else {
// define the layer in the loop we're currently looking at
var myLayer = app.project.activeItem.layer(1);
var curVal = myLayer.property("Scale").value;
myLayer.property("Scale").setValue([-100, 100]);
var Text = selectedLayers[0].Text.Animators.addProperty("ADBE Text Animator");
myText.property("ADBE Text Selectors").addProperty("ADBE Text Selector");
myText.property("ADBE Text Animator Properties").addProperty("ADBE Text Scale 3D").setValue([-100, 100]);
}
// close the undo group
app.endUndoGroup();
} //Hebrew this button ended.
//cancel button
Cancel.onClick = function() {
app.beginUndoGroup("AddEffect");
var curItem = app.project.activeItem;
var selectedLayers = curItem.selectedLayers;
// check if comp is selected
if (curItem == null || !(curItem instanceof CompItem)) {
// if no comp selected, display an alert
alert("בבקשה בחר שכבה");
} else {
// define the layer in the loop we're currently looking at
var myLayer = app.project.activeItem.layer(1);
var curVal = myLayer.property("Scale").value;
myLayer.property("Scale").setValue([100, 100]);
var myAnim = selectedLayers[0].Text.Animators.property("ADBE Text Animator");
myAnim.property("ADBE Text Selectors").property("ADBE Text Selector");
myAnim.property("ADBE Text Animator Properties").property("ADBE Text Scale 3D").setValue([100, 100]);
}
// close the undo group
app.endUndoGroup();
}
return myWindow;
} //UI Creation End.//
})(this);
Copy link to clipboard
Copied
First of all- thanks.
second of all -
i have a problem.
i put it in to the scriptUI folder and ran it through the window tab, and...

Copy link to clipboard
Copied
Oh, Im sorry. Had to fix one line in the code. My bad.
(function(thisObj) {
var scriptPalette = scriptBuildUI(thisObj);
if (scriptPalette !== null && scriptPalette instanceof Window) {
scriptPalette.center();
scriptPalette.show();
} else {
scriptPalette.layout.layout(true);
}
function scriptBuildUI(thisObj) {
//UI Creation
var myWindow = (thisObj instanceof Panel) ? thisObj : new Window("palette", prefs.script.name, undefined, {
resizeable: true
});
var myMessage = myWindow.add("statictext");
myMessage.text = "תסריט להפיכת טקסט. נעשה על ידי איתי אסולין";
var buttons = myWindow.add("panel", undefined, "buttons");
buttons.orientation = "row";
var HebrewThis = buttons.add("button", undefined, "HebrewThis!");
var Cancel = buttons.add("button", undefined, "Cancel");
//Hebrew this button
HebrewThis.onClick = function() {
app.beginUndoGroup("AddEffect");
var curItem = app.project.activeItem;
var selectedLayers = curItem.selectedLayers;
// check if comp is selected
if (curItem == null || !(curItem instanceof CompItem)) {
// if no comp selected, display an alert
alert("בבקשה בחר שכבה");
} else {
// define the layer in the loop we're currently looking at
var myLayer = app.project.activeItem.layer(1);
var curVal = myLayer.property("Scale").value;
myLayer.property("Scale").setValue([-100, 100]);
var Text = selectedLayers[0].Text.Animators.addProperty("ADBE Text Animator");
myText.property("ADBE Text Selectors").addProperty("ADBE Text Selector");
myText.property("ADBE Text Animator Properties").addProperty("ADBE Text Scale 3D").setValue([-100, 100]);
}
// close the undo group
app.endUndoGroup();
} //Hebrew this button ended.
//cancel button
Cancel.onClick = function() {
app.beginUndoGroup("AddEffect");
var curItem = app.project.activeItem;
var selectedLayers = curItem.selectedLayers;
// check if comp is selected
if (curItem == null || !(curItem instanceof CompItem)) {
// if no comp selected, display an alert
alert("בבקשה בחר שכבה");
} else {
// define the layer in the loop we're currently looking at
var myLayer = app.project.activeItem.layer(1);
var curVal = myLayer.property("Scale").value;
myLayer.property("Scale").setValue([100, 100]);
var myAnim = selectedLayers[0].Text.Animators.property("ADBE Text Animator");
myAnim.property("ADBE Text Selectors").property("ADBE Text Selector");
myAnim.property("ADBE Text Animator Properties").property("ADBE Text Scale 3D").setValue([100, 100]);
}
// close the undo group
app.endUndoGroup();
}
return myWindow;
} //UI Creation End.//
})(this);
Copy link to clipboard
Copied
Thank you so much! ❤️
it works grate.
thanks man!
Copy link to clipboard
Copied
here my script to build my window!
I want it dockable !
Everybody can help me?
//------------------------------------------------
var interprate_palette = new Window("window","INTERPRET WINDOW");
if (interprate_palette != null)
{
var projGrp = interprate_palette.add ("Panel", [10,10,300,120],"Interpret");
var ignChk = projGrp.add("checkbox",[10,10,80,30],"Ignore");
var interoBnt = projGrp.add("button",[200,10,280,30],"Interpret");
var whiteChk = projGrp.add("checkbox",[10,40,60,60],"White");
var grayChk = projGrp.add("checkbox",[80,40,130,60],"Gray");
var blackChk = projGrp.add("checkbox",[140,40,190,60],"Black");
var ColorBnt = projGrp.add("button",[200,40,280,60],"Color");
var loopLabel = projGrp.add("statictext",[10,70,90,90],"Loop footage :");
var looptxt = projGrp.add("edittext",[100,70,160,90],"1");
var loopBnt = projGrp.add("button",[200,70,280,90],"Loop");
interprate_palette.bounds = [50,50,360,180];
interprate_palette.show();
}
ignChk.value = 1;
ignChk.onClick = ignSelect;
whiteChk.onClick = whiteSelect;
grayChk.onClick = graySelect;
blackChk.onClick = blackSelect;
interoBnt.onClick = interpretObj;
ColorBnt.onClick = getColorPremut;
loopBnt.onClick = getLoop;
//------------------------------------------------
Copy link to clipboard
Copied
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more