var doc = activeDocument;
var fontname=doc.activeLayer.textItem.font
var w = new Window ("dialog");
var button1 = w.add ("Button", [0,0,180,20], "1");
button1.active = true
button1.text ="Font_Name"
button1.preferredSize.width = 180;
button1.onChanging = function(){ button1.text = fontname};
w.show()
I'd like to change it to a font name when I click the button.
It doesn't work well.
button1.onChanging
Re: button1.onChanging
ScriptUI for dummies / Page 78
Re: button1.onChanging
Thank you very much.
I referred to the sauce below.
--------------------------------------------------------------------
#target photoshop
var pic1File;
var pic2File;
var dlg = new Window( "dialog", "Alert Box Builder" );
btnPnl = dlg.add( "panel", undefined, "Build it" );
pic1Btn = btnPnl.add( "button", undefined, "Image 1" );
pic2Btn = btnPnl.add( "button", undefined, "Image 2" );
buildBtn = btnPnl.add( "button", undefined, "Build", {name: "ok" } );
cancelBtn = btnPnl.add( "button", undefined, "Cancel", { name: "cancel" } );
pic1Btn.onClick = function() {
pic1File = new File;
pic1File = pic1File.openDlg ( "Select Background Image", "Images: *.png; *.jpeg; *.jpg" )
if( pic1File != null ) { pic1Btn.text = File.decode ( pic1File.name ) }
else {
pic1File = new File;
pic1Btn.text = "No file selected";
}
}
pic2Btn.onClick = function() {
pic2File = new File;
pic2File = pic2File.openDlg ( "Select Background Image", "Images: *.png; *.jpeg; *.jpg" )
if( pic2File != null ) { pic2Btn.text = File.decode ( pic2File.name ) }
else {
pic2File = new File;
pic2Btn.text = "No file selected";
}
}
dlg.show();
I referred to the sauce below.
--------------------------------------------------------------------
#target photoshop
var pic1File;
var pic2File;
var dlg = new Window( "dialog", "Alert Box Builder" );
btnPnl = dlg.add( "panel", undefined, "Build it" );
pic1Btn = btnPnl.add( "button", undefined, "Image 1" );
pic2Btn = btnPnl.add( "button", undefined, "Image 2" );
buildBtn = btnPnl.add( "button", undefined, "Build", {name: "ok" } );
cancelBtn = btnPnl.add( "button", undefined, "Cancel", { name: "cancel" } );
pic1Btn.onClick = function() {
pic1File = new File;
pic1File = pic1File.openDlg ( "Select Background Image", "Images: *.png; *.jpeg; *.jpg" )
if( pic1File != null ) { pic1Btn.text = File.decode ( pic1File.name ) }
else {
pic1File = new File;
pic1Btn.text = "No file selected";
}
}
pic2Btn.onClick = function() {
pic2File = new File;
pic2File = pic2File.openDlg ( "Select Background Image", "Images: *.png; *.jpeg; *.jpg" )
if( pic2File != null ) { pic2Btn.text = File.decode ( pic2File.name ) }
else {
pic2File = new File;
pic2Btn.text = "No file selected";
}
}
dlg.show();
Re: button1.onChanging
Where's the correlation to original 'font' issue?