Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Check grids in the document:

Engaged ,
Mar 18, 2020 Mar 18, 2020

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();
TOPICS
Actions and scripting
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Mentor ,
Mar 18, 2020 Mar 18, 2020

cb1.value = activeDocument.guides.length 

 

?

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 18, 2020 Mar 18, 2020

Hi DmitryEgorov , I need to check "grids" not guids

 
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 18, 2020 Mar 18, 2020

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);
};

 

 

 

JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 18, 2020 Mar 18, 2020

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 18, 2020 Mar 18, 2020

Its in the Adobe manual but is greek to me

image.png

image.png

JJMack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Mar 18, 2020 Mar 18, 2020
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines