I'm trying to do something that should be be quite basic for a programer, but unfortunately unfortunately being a designer I'm having a heck of a time with this. Having spent hours searching and trying different things I thought of posting the problem. I have the feeling I'm not the first designer struggling with this.
I'm trying to pull input data from a window and pass it on to a variable. In the script I do a couple of purge(), and I'm not sure if that will clear the user input values during the script, but this is thinking ahead...
I need values to do:
layer.translate(X, Y) // If I'm not wrong this needs to be a - string
bitsaveoptions.method = ChanelScreen; //from drop down menu
bitsaveoptions.angle = KAngle // If I'm not wrong this needs to be a - integer
bitsaveoptions.frequency = ChanelFrequency; // If I'm not wrong this needs to be a - integer
bitsaveoptions.resolution = ChanelResolution; // If I'm not wrong this needs to be a - integer
bitsaveoptions.shape = BitmapHalfToneType.ROUND; //from drop down menu
I know that there are different ways to retrieve the data from a window .selection .value and maybe others but I can't seem to pull the data out of from the user input
Any advice would be greatly appreciated.
Thanks.
PS I'm working with Photoshop CS5
This is what I have so far.
// =========== Ruler to Millimiters
app.preferences.rulerUnits = Units.MM;
var doc = app.activeDocument;
var layer = doc.activeLayer;
var dropdownlistArray = new Array();// The array of drop down lists.
var chosen_action = null;
var ScreenShapeArray= new Array(
'Round',
'Eliptical'
);
var WinContent =
"dialog{\
orientation: 'column', \
alignChildren: ['fill', 'top'], \
preferredSize:[300, 130], \
text: 'Export Settings', \
margins:15, \
\
Coordinates: Panel {\
orientation: 'column', \
text: 'Chanels Shifts', \
margins:15, \
alignChildren: 'right',\
KChanelX: Group{\
st: StaticText { text: 'X:' }, \
te: EditText { text: '15', characters: 4, justify: 'right'} \
st2: StaticText { text: 'mm' }, \
} \
KChanelY: Group{\
st: StaticText { text: 'Y:' }, \
te: EditText { text: '10', characters: 4, justify: 'right'} \
st2: StaticText { text: 'mm' }, \
}\
}\
bottomGroup: Group{\
cancelButton: Button { text: 'Cancel', properties:{name:'cancel'}, size: [120,24], alignment:['right', 'center'] }, \
applyButton: Button { text: 'Apply', properties:{name:'ok'}, size: [120,24], alignment:['right', 'center'] }, \
}\
}"
// ======== Create window object
var win = new Window(WinContent);
// ======== Display Window
win.show();
var X =parseInt(win.Coordinates.KChanelX.te.selection);
var Y =parseInt(win.Coordinates.KChanelY.te.selection);
alert (X); // Here I get NaN
alert (Y); // Here I get NaN
if (typeof(X) === "undefined" || typeof(Y) === "undefined" ){
layer.translate(X+"mm", "-"+Y+"mm");
}else {
alert ("here"); // Always end-up here regardles of canling or acepting the default values
};