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

Help with script interface design

Explorer ,
Feb 25, 2025 Feb 25, 2025

How do I make the 'Story' & 'Document' radio buttons be on one line?

צילום מסך 2025-02-25 ב-12.05.52.pngexpand image

 I tried a lot with AI and it didn't work 🙂

 

 

    var dialog = app.dialogs.add({name: "Pstyle2tables"});
    
    var column = dialog.dialogColumns.add();
    var styleRow = column.dialogRows.add();
    var styleDropdown = styleRow.dropdowns.add({
        stringList: allParaStyles,
        selectedIndex: 0
    });
    
    var scopeRow = column.dialogRows.add();
    var radioBtns = scopeRow.radiobuttonGroups.add();
    var currentStoryRadio = radioBtns.radiobuttonControls.add({staticLabel: "Story", checkedState: true});
    var entireDocRadio = radioBtns.radiobuttonControls.add({staticLabel: "Document", checkedState: false});

    var result = dialog.show();
    
    if (result) {
        var selectedStyleName = allParaStyles[styleDropdown.selectedIndex];
        var selectedStyle = doc.paragraphStyles.itemByName(selectedStyleName);
        
        var workOnEntireDoc = entireDocRadio.checkedState;
        
        var tablesProcessed = 0;
        
        dialog.destroy();
        

 

Thanks to human intelligence!

TOPICS
Scripting
114
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

correct answers 1 Correct answer

Community Expert , Feb 25, 2025 Feb 25, 2025

I can never get indesign ui to behave

My solution so far has been to invent your own

 

// Attempt to get the active document and its paragraph styles
try {
    var doc = app.activeDocument;
    var allParaStyles = doc.paragraphStyles.everyItem().name;
} catch (e) {
    // If no document is open, use a dummy list for testing
    var allParaStyles = ["Style 1", "Style 2", "Style 3"];
}

var dlg = new Window("dialog", "Pstyle2tables");
dlg.orientation = "column";
dlg.alignChildren = "fill";

// Cre
...
Translate
Community Expert ,
Feb 25, 2025 Feb 25, 2025
LATEST

I can never get indesign ui to behave

My solution so far has been to invent your own

 

// Attempt to get the active document and its paragraph styles
try {
    var doc = app.activeDocument;
    var allParaStyles = doc.paragraphStyles.everyItem().name;
} catch (e) {
    // If no document is open, use a dummy list for testing
    var allParaStyles = ["Style 1", "Style 2", "Style 3"];
}

var dlg = new Window("dialog", "Pstyle2tables");
dlg.orientation = "column";
dlg.alignChildren = "fill";

// Create a row group for paragraph style selection
var styleGroup = dlg.add("group");
styleGroup.orientation = "row";
styleGroup.add("statictext", undefined, "Paragraph Style:");
var styleDropdown = styleGroup.add("dropdownlist", undefined, allParaStyles);
styleDropdown.selection = 0;

// Create a row group for the radio buttons
var radioGroup = dlg.add("group");
radioGroup.orientation = "row";
var storyRadio = radioGroup.add("radiobutton", undefined, "Story");
storyRadio.value = true;
var docRadio = radioGroup.add("radiobutton", undefined, "Document");

// Add OK and Cancel buttons
var btnGroup = dlg.add("group");
btnGroup.alignment = "right";
btnGroup.add("button", undefined, "OK", {name: "ok"});
btnGroup.add("button", undefined, "Cancel", {name: "cancel"});

// Show the dialog
if (dlg.show() == 1) {
    // OK pressed
    var selectedStyleName = styleDropdown.selection.text;
    var selectedStyle = doc.paragraphStyles.itemByName(selectedStyleName);
    var workOnEntireDoc = docRadio.value;
    
    // Your processing code here
}

 

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