Skip to main content
Participating Frequently
October 17, 2022
Answered

Script Update text in Custom Window.

  • October 17, 2022
  • 4 replies
  • 836 views

Hi guys,

 

I created a small script where the path and filename are exposed in the window via:

A simplified version would be: 

 

var compo = app.project.activeItem;
var text = panelSplit2.add("statictext", undefined, "VALUE_B"+ compo);

 

The problem is when I Save Incremental Version the text is still the same even when I update compo to the new value. Is there any way to update the text?

Something like: 

var text = panelSplit2.update("statictext", undefined, "VALUE_B"+ compo);

Thanks very much!
Nacho

This topic has been closed for replies.
Correct answer Mathias Moehl

Hi Nacho,

good idea to show a minimal example.

If you do

var labelObj = panelSplit2.add("statictext", undefined, "VALUE_B"+ compo);

then the variable "labelObj" contains an object with properties, which you can modify later. Like

labelObj.text = "my new text";

Here is an overview of the properties which the object has - depending of the type of the UI element:

https://extendscript.docsforadobe.dev/user-interface-tools/common-properties.html#common-properties

 

4 replies

Mylenium
Legend
October 18, 2022

You can style panels with HTML/ CSS and the respective JSON equivalents. That would allow you to use alternate fonts and font weights. It's quite limited, though, and the documentation and examples are indeed rather sparse because too few people seem to use it.

 

Mylenium

Nacho G.Author
Participating Frequently
October 18, 2022

Thanks, will try it later, only when everything is completly functional.

Mathias Moehl
Community Expert
Mathias MoehlCommunity ExpertCorrect answer
Community Expert
October 18, 2022

Hi Nacho,

good idea to show a minimal example.

If you do

var labelObj = panelSplit2.add("statictext", undefined, "VALUE_B"+ compo);

then the variable "labelObj" contains an object with properties, which you can modify later. Like

labelObj.text = "my new text";

Here is an overview of the properties which the object has - depending of the type of the UI element:

https://extendscript.docsforadobe.dev/user-interface-tools/common-properties.html#common-properties

 

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Nacho G.Author
Participating Frequently
October 18, 2022

Awesome!! It worked! Didn´t know about properties, this is awesome. Thanks!

 

Mathias Moehl
Community Expert
Community Expert
October 19, 2022

Great! Then you best mark the answer as correct, such that other users later can find the solution quickly 🙂

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Mylenium
Legend
October 18, 2022

I think you may need to reload the project to get this working correctly.

 

Mylenium 

Nacho G.Author
Participating Frequently
October 18, 2022

Ok, I´ll have to live with it. Anyway the Open Folder which is the important keeps updated. 

BTW: Do you know how can I use bold letter in the window? All the bold searches I found end up being about the Text Tools.

Thanks very much for your help!
Nacho

Mylenium
Legend
October 18, 2022

Without the full code nobody can tell you much. No offense, but anyone can throw together some lines that look fancy but do nothing. In your case the actual loop this runs in and the event triggered by the save operation are relevant and we need to understand how you put it together.

 

Mylenium

Nacho G.Author
Participating Frequently
October 18, 2022

Thanks Mylenium!
No offense at all, I´m not a coder and just wanted to send code as small as possible. Here I created a short version with a working code. The issue is: if I hit Save Incremental Version for example and the file name changes the Open Folder function recognizes the file name change and shows updated values, but the text is obviously stucked in the original value, and I don`t know how to update this text to the new file name. 

 

Hope this makes sense.

Thanks for the help!
Nacho

 

 

var renderWindow = new Window("palette", "LaSP Render", undefined);
renderWindow.orientation = "column";
var panelRender = renderWindow.add("panel", undefined, "WINDOW");
panelRender.orientation = "row";

var openFolderButton = panelRender.add("button", undefined, "Open Folder");
var commandInt;

var panelSplit2 = renderWindow.add("panel", undefined, "PARSEO");
panelSplit2.orientation = "column";
var text = panelSplit2.add("statictext", undefined, "OUTPUT "+ getOutputAll());
openFolderButton.onClick = function() {
    var f = new Folder(getOutputAll());
    if ( ! f.exists ) {
        f.create()
    }
    f.execute()
}

function getOutputAll() {
    var pathArchivoAE = app.project.file;
    var outputPath = "C:/RENDERS/" + pathArchivoAE_string +"/";
    return outputPath;
}
renderWindow.center();
renderWindow.show();