简体   繁体   中英

Photoshop Script return value of input

I have the following input in a script for Photoshop, how can I return its value?

var cal_char = cal.add('edittext', [25,40,135,60], 'asdf');

I've tried cal_char.value but it returns undefined

You want

 cal_char.text

To put in context, I've added buttons and an alert see it here:

// New UI window
var cal = new Window ("dialog", "Blah!");
var cal_char = cal.add("edittext", [25,40,135,60], "asdf");

// buttons
var btnGroup = cal.add ("group");
btnGroup.orientation = "row";
btnGroup.alignment = "center";
btnGroup.add ("button", undefined, "OK");
btnGroup.add ("button", undefined, "Cancel")
cal.center();

var myReturn = cal.show();

if (myReturn == 1)
{
    // set checkboxes and input here
    var chars = cal_char.text;
}

alert("You wrote: '" + chars + "'");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM