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

Error Javascript 29446

Explorer ,
Feb 01, 2024 Feb 01, 2024

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

 

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

Engaged , Feb 01, 2024 Feb 01, 2024

Hi @Carmelo5FA3 

Please change this line:

var files = folder.getFiles("*.indd");
Translate
Engaged ,
Feb 01, 2024 Feb 01, 2024

Hi @Carmelo5FA3 

Please change this line:

var files = folder.getFiles("*.indd");
Thanks,
Prabu
Design smarter, faster, and bolder with InDesign scripting.
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
Explorer ,
Feb 01, 2024 Feb 01, 2024
LATEST

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

 

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