Why does this code not work with a version of InDesign?
Hello everyone, I'm trying to understand why the code I attach works perfectly with InDesign 19.x and does not work with Indesign 20.x (see image)

Both versions of InDesign are on MacOS Ventura 13.7.5. Is it perhaps a bug in the latest version of InDesign?
Is it a bug in the latest version of InDesign or a stupid mistake of mine? Thanks to all.
Here is the code:
function createFolder(folder) {
var script = "";
script += "try\r";
script += "do shell script \"mkdir \" & quote & item 1 of arguments & quote\r";
script += "tell application id \"com.adobe.InDesign\"\r";
script += "tell script args\r";
script += "set value name \"success\" value \"true\"\r";
script += "end tell\r";
script += "end tell\r";
script += "on error\r";
script += "tell application id \"com.adobe.InDesign\"\r";
script += "tell script args\r";
script += "set value name \"success\" value \"false\"\r";
script += "end tell\r";
script += "end tell\r";
script += "end try\r";
app.doScript(script, ScriptLanguage.applescriptLanguage, Array(folder.fsName));
if(app.scriptArgs.getValue('success') == "false") {
return false;
} else {
return true;
}
}
if(document.saved) {
var file = new File(document.filePath + "/New folder");
} else {
var file = new File("~/Documents/New folder");
}
var saveFile = file.saveDlg(
"Create folder",
"All files:*"
);
if(saveFile) {
var folder = new Folder(saveFile.fullName);
if(folder.exists) throw {
message: "The folder '" + folder.name + "' already exists.",
level: "Warning"
};
if(!createFolder(folder)) throw {
message: "Error creating folder.",
level: "Error"
};
};
