Copy link to clipboard
Copied
In the dialog screen
How do I convert a number entry
does not cause
I write
var s = Number(sAtext.text)
and
s*3
var w = new Window("dialog");
w.orientation = "row";
w.alignChildren = "left";
var sA = w.add("statictext", undefined, "A)");
var sAtext = w.add("edittext", [0, 0, 35, 20]);
sAtext.active = true;
var sB = w.add("statictext", undefined, "B)");
var sBtext = w.add("edittext", [0, 0, 35, 20]);
w.add("button", undefined, "TAMAM", {name: "ok"}).onClick = function() {
w.close(8);
};
var a = "A) "
var b = "B) "
var c = "C) "
var d = "D) "
var e = "E) "
var s = Number(sAtext.text); // ????????????????????
var k = Number(sBtext.text); // ????????????????????
var cAse = w.show();
if(cAse == 8) {
if (app.selection[0].characters.length > 0){
app.selection[0].texts[0].remove();
}
app.selection[0].texts[0].insertionPoints.item(-1).contents = a + ((s*1) + (k * 0));
app.selection[0].insertionPoints[-1].contents = SpecialCharacters.FLUSH_SPACE;
app.selection[0].texts[0].insertionPoints.item(-1).contents = b + ((s*1) + (k * 1));
app.selection[0].insertionPoints[-1].contents = SpecialCharacters.FLUSH_SPACE;
app.selection[0].texts[0].insertionPoints.item(-1).contents = c + ((s*1) + (k * 2));
app.selection[0].insertionPoints[-1].contents = SpecialCharacters.FLUSH_SPACE;
app.selection[0].texts[0].insertionPoints.item(-1).contents = d + ((s*1) + (k * 3));
app.selection[0].insertionPoints[-1].contents = SpecialCharacters.FLUSH_SPACE;
app.selection[0].texts[0].insertionPoints.item(-1).contents = e + ((s*1) + (k * 4));
}
Copy link to clipboard
Copied
Quick debug ...
var a="A) ",b="B) ",c="C) ",d="D) ",e="E) ",s,k;
//
mDialog()
//
mFunction()
//
function mDialog(){
var w = new Window("dialog");
w.orientation = "row";
w.alignChildren = "left";
var sA = w.add("statictext", undefined, "A)");
var sAtext = w.add("edittext", [0, 0, 35, 20]);
sAtext.active = true;
var sB = w.add("statictext", undefined, "B)");
var sBtext = w.add("edittext", [0, 0, 35, 20]);
//
var cancelButton=w.add("button", undefined, "Cancel", {name: "cancel"});
var okButton = w.add("button", undefined, "TAMAM", {name: "ok"});
if (w.show () == 1){
s = Number(sAtext.text);
k = Number(sBtext.text);
if ((isNaN(s)) || (isNaN(k))){
alert("Not a number");
exit();
}
}else{
exit();
}
}
//
function mFunction(){
if (app.selection[0].characters.length > 0){
app.selection[0].texts[0].remove();
}
app.selection[0].texts[0].insertionPoints.item(-1).contents = a + ((s*1) + (k * 0));
app.selection[0].insertionPoints[-1].contents = SpecialCharacters.FLUSH_SPACE;
app.selection[0].texts[0].insertionPoints.item(-1).contents = b + ((s*1) + (k * 1));
app.selection[0].insertionPoints[-1].contents = SpecialCharacters.FLUSH_SPACE;
app.selection[0].texts[0].insertionPoints.item(-1).contents = c + ((s*1) + (k * 2));
app.selection[0].insertionPoints[-1].contents = SpecialCharacters.FLUSH_SPACE;
app.selection[0].texts[0].insertionPoints.item(-1).contents = d + ((s*1) + (k * 3));
app.selection[0].insertionPoints[-1].contents = SpecialCharacters.FLUSH_SPACE;
app.selection[0].texts[0].insertionPoints.item(-1).contents = e + ((s*1) + (k * 4));
}
Copy link to clipboard
Copied
mfunction into attaching why give error
if(sAtext.text.length == 1 && sBtext.text.length == 0)
Copy link to clipboard
Copied
Why testing sAtext.text.length and sBtext.text.length ?
You can test numeric value of a & s ...
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more