Skip to main content
Inspiring
February 1, 2024
Answered

Error Javascript 29446

  • February 1, 2024
  • 1 reply
  • 590 views

Hi everyone,

 

I was trying to adapt a script that a user of this community kindly compiled for me, and I am getting the error 29446, and I don't know why.

I will post a screenshot of the error and the code, so maybe someone can explain what is wrong.

 

 

var folder = Folder.selectDialog("Select the folder");

var myDialog = app.dialogs.add({
    name: "Custom Dialog",
    canCancel: true
});

with(myDialog.dialogColumns.add()) {
    with(dialogRows.add()) {
        staticTexts.add({staticLabel: "Height (mm):"});
        var heightField = textEditboxes.add({editContents: "000"});
    }
    with(dialogRows.add()) {
        staticTexts.add({staticLabel: "Width (mm):"});
        var widthField = textEditboxes.add({editContents: "000"});
    }
}

if (myDialog.show() == true) {
    var height = heightField.editContents;
    var width = widthField.editContents;
    myDialog.destroy();
} else {
   
    alert("Task closed.");
}


var heightMillimeters = height + "mm";
var widthMillimeters = width + "mm";


if (folder != null) {
    var files = folder.getFiles();

    for (var i = 0; i < files.length; i++) {
       
        var document = app.open(files[i]);

        document.documentPreferences.pageHeight = heightMillimeters;
        document.documentPreferences.pageWidth = widthMillimeters;

        document.save();
        document.close();
    }
}

 

This topic has been closed for replies.
Correct answer Anantha Prabu G

Hi @Carmelo5FA3 

Please change this line:

var files = folder.getFiles("*.indd");

1 reply

Anantha Prabu G
Anantha Prabu GCorrect answer
Legend
February 1, 2024

Hi @Carmelo5FA3 

Please change this line:

var files = folder.getFiles("*.indd");
Design smarter, faster, and bolder with InDesign scripting.
Inspiring
February 1, 2024

Hi @Anantha Prabu G, and thanks (again) for your help.