Copy link to clipboard
Copied
Hello everyone!
Friends I need to open a dialog window with a ckekbox, however, it is necessary to check if in the current document it has grids, if it is true, the chekbox has a true validation "cb1.value = true;". Serial possible? Thanks.
dlg = new Window("dialog");
cb1 = dlg.add("checkbox", undefined, undefined, {name: "cb1"});
cb1.text = "Checkbox";
cb1.value = false;
dlg.show();
Copy link to clipboard
Copied
cb1.value = activeDocument.guides.length
?
Copy link to clipboard
Copied
Hi DmitryEgorov , I need to check "grids" not guids
Copy link to clipboard
Copied
You will most likely need to use Action Manger javascript coded to get some action reference to check the toggle state of menu View>Show>Grid shortcut Ctrl+' I don't know how to code that. Perhaps R-bin will help.
Once you know the toggle state you can toggle the state if you need to.
function ToggleGrid() {
var dialogMode = DialogModes.NO;
var desc1 = new ActionDescriptor();
var ref1 = new ActionReference();
ref1.putEnumerated(app.charIDToTypeID('Mn '), app.charIDToTypeID('MnIt'), app.charIDToTypeID('TgGr'));
desc1.putReference(app.charIDToTypeID('null'), ref1);
executeAction(app.charIDToTypeID('slct'), desc1, dialogMode);
};
Copy link to clipboard
Copied
Thanks for the support JJMack .I confess that it is very difficult for us to find a code that checks the current status of this command.
Copy link to clipboard
Copied
Its in the Adobe manual but is greek to me
Copy link to clipboard
Copied
Menu selection commands return an empty descriptor. We do not know state of menu item before executeAction command and after. We can only switch it.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now