Hi,
I'm new to javascripting, and I have just read the dialog objects. I tried to use a sample script to come up with my own. Here it is:
var dialog2 =
{
initialize: function(dialog) {
dialog.load({
"bled": "0",
"pgwd": "0",
"pght": "0",
"rd01": true,
"rd02": false,
"rd03": false
}),
this.hasPet = false;
dialog.enable({
"bled" : this.hasPet
});
},
commit: function(dialog)
{
var aaa = dialog.store()["pgwd"];
var bbb = dialog.store()["pght"];
var ccc = dialog.store()["bled"];
var eee = dialog.store()["rd01"];
var fff = dialog.store()["rd02"];
var ggg = dialog.store()["rd03"];
if (eee == true) {
var x = 2.83464762
}
else {
if (fff == true) {
var x = 72
}
else {
if (ggg == true) {
var x = 1
}
}
}
for (var i = 0; i < numPages; i++) {
var ddd = this.getPageBox("Media", i);
var a = ddd[0]
var b = ddd[1]
var c = ddd[2]
var d = ddd[3]
console.println(a+" "+b+" "+c+" "+d)
}
},
ok: function(dialog) {
console.println("Ok!")
},
ckbx: function (dialog) {
this.hasPet = !this.hasPet;
dialog.enable({
"bled" : this.hasPet,
});
},
cancel: function(dialog) {
console.println("Cancel!");
},
description:
{
name: "Resize Page Box",
elements:
[
{
type: "view",
align_children: "align_left",
elements:
[
{
type: "static_text",
name: "Required Data",
bold: true,
font: "dialog",
char_width: 30,
height: 20
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "Page Width: ",
},
{
type: "edit_text",
item_id: "pgwd",
group_id: "pgbx",
name: "Page Width",
char_width: 5,
height: 20
},
{
type: "static_text",
name: "Page Height: ",
},
{
type: "edit_text",
item_id: "pght",
group_id: "pgbx",
char_width: 5,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "check_box",
item_id: "ckbx",
name: "Bleed"
},
{
type: "edit_text",
item_id: "bled",
char_width: 5,
height: 20
}
]
},
{
type: "view",
align_children: "align_row",
elements:
[
{
type: "static_text",
name: "Units of measurements: "
},
{
type: "radio",
item_id: "rd01",
group_id: "rado",
name: "millimeter"
},
{
type: "radio",
item_id: "rd02",
group_id: "rado",
name: "inch",
},
{
type: "radio",
item_id: "rd03",
group_id: "rado",
name: "point",
}
]
},
{
type: "ok_cancel",
ok_name: "Ok",
cancel_name: "Cancel",
}
]
},
]
}
};
var retn = app.execDialog(dialog2)
But when I press the ctrl enter, nothing happens. When I changed the code:
var ddd = this.getPageBox("Media", i);
var a = ddd[0]
var b = ddd[1]
var c = ddd[2]
var d = ddd[3]
console.println(a+" "+b+" "+c+" "+d)
to:
console.println(x)
I get an output.
Can someone please explain what I missed and what do I need to add to this code for it to work. Thanks! and more power!!!