Copy link to clipboard
Copied
Hello,
Task of the checkboxes in the popup window is to write the checkbox values to File > Properties > Description > Title.
If you selected 2 checkboxes, a ";" should be a separator between the 2 fields in the File > Properties > Description > Title field.
If you select only 1 checkbox, there is NO ; at all.
If you select 3 checkboxes, the separator is always a ; (in this case 2 times a ; )
This is one of my tries, hope that some freaks can help me.
I need also to exand the checkboxes until 9 different checkboxes.
var dialog2 =
{
initialize: function(dialog) {
// Set a default value for radio button field
dialog.load({"ckb1": true });
},
commit: function(dialog) {
// When the user presses "Ok", this handler will execute first
var results = dialog.store();
},
// The dialog box description
description:
{
name: "More Personal Information",
elements:
[
{
type: "view",
align_children: "align_left",
elements:
[
{
type: "static_text",
name: "Personal Information",
bold: true,
font: "dialog",
char_width: 30,
height: 20
},
{
type: "check_box",
item_id: "ckb1",
name: "Pet Owner"
},
{
type: "check_box",
item_id: "ckb2",
name: "Pet Owner test"
},
{
type: "check_box",
item_id: "ckb3",
name: "Pet Owner test"
},
]
},
{
type: "gap", //Add a small vertical gap between
height: 10 //check boxes and buttons
},
{
type: "ok_cancel",
ok_name: "Ok",
cancel_name: "Cancel"
}
]
}
};
this.info.author=""
if ("ok"==app.execDialog(dialog2)){
this.info.title=dialog2.results
};
Examples
checkbox 1 and 2 selected results in: Pet Owner;Pet Owner test
checkbox 1 selected results in: Pet Owner
checkbox 1 and 2 and 3 selected results in: Pet Owner;Pet Owner test;Pet Owner test
No checkbox selected results in: <<empty field>>
You're not really doing anything in the commit function. Use this code instead:
commit: function(dialog) {
// When the user presses "Ok", this handler will execute first
var results = dialog.store();
var tickedItems = [];
if (results["ckb1"])
tickedItems.push("Pet Owner");
if (results["ckb2"])
tickedItems.push("Pet Owner test1");
if (results["ckb3"])
tickedItems.push("Pet Owner test2");
this.results = tickedItems.join(";");
},
Copy link to clipboard
Copied
Additional info.
Now there is no info written at all to Properties of the files. So there are some additional bugs in my code to solve.
Copy link to clipboard
Copied
You're not really doing anything in the commit function. Use this code instead:
commit: function(dialog) {
// When the user presses "Ok", this handler will execute first
var results = dialog.store();
var tickedItems = [];
if (results["ckb1"])
tickedItems.push("Pet Owner");
if (results["ckb2"])
tickedItems.push("Pet Owner test1");
if (results["ckb3"])
tickedItems.push("Pet Owner test2");
this.results = tickedItems.join(";");
},
Copy link to clipboard
Copied
Mission accomplished! Thank you for helping try67!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now