Question
Modal windows when button on click
Hi, I have a question, I have created this script to launch different types of commands, I have created a function for each command, but I have not figured out how to get the button to launch it, It gives me the error that a modal window is open.
Script here
// Path file master
var masterManutenzionePath = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\00_Manuale d'uso\\File master-template\\0091M - [MANUTENZIONE] - NEW.indd";
var masterManutenzioneDPIPath = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\00_Manuale d'uso\\File master-template\\0091M - [MANUTENZIONE_DPI] - NEW.indd";
var masterLavaggio1Path = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\00_Manuale d'uso\\File master-template\\0093L - [LAVAGGIO 1 ZONA].indd";
var masterLavaggio2Path = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\00_Manuale d'uso\\File master-template\\0093L - [LAVAGGIO 2 ZONE].indd";
var masterPittogrammiPath = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\00_Manuale d'uso\\File master-template\\0103P - [PITTOGRAMMI].indd";
var masterMovinPath ="\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\00_Manuale d'uso\\File master-template\\0072M - [MOVIN].indd";
//-----
// File master
var ManutenzioneFile = File(masterManutenzionePath);
var ManutenzioneDPIFile = File(masterManutenzioneDPIPath);
var Lavaggio1File = File(masterLavaggio1Path);
var Lavaggio2File = File(masterLavaggio2Path);
var PittogrammiFile = File(masterPittogrammiPath);
var MovinFile = File(masterMovinPath);
//-----
// Path file
var ManutenzionePath = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\30_File UTM\\Manutenzione programmata\\test";
var ManutenzioneDPIPath = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\30_File UTM\\Manutenzione programmata";
var Lavaggio1Path = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\30_File UTM\\Lavaggio";
var Lavaggio2Path = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\30_File UTM\\Lavaggio";
var PittogrammiPath = "\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\30_File UTM\Pittogrammi";
var MovinPath ="\\\\ftsystem.local\\root\\FTSystem-HQ\\UTDocs\\File standard\\30_File UTM\Movin";
//-----
// File manutenzione DPI
var filesManutenzioneDPI = "0091M - iM2.indd";
//-----
// File lavaggio 1 zona
var filesLavaggio1Zona = [
"0093L4 - Specola.indd",
"0093L4 - Sistema centraggio bottiglia.indd",
"0093L4 - Sistema centraggio bottiglia - AA.indd",
"0093L4 - Presenza metalli.indd",
"0093L4 - Espulsore Z200.indd",
"0093L4 - Espulsore soffio.indd",
"0093L4 - Espulsore push.indd",
"0093L4 - Espulsore push Z100_MOD.indd",
"0093L3 - Moduli rilevamento.indd",
"0093L3 - Controllo in macchina IE.indd",
"0093L3 - Controllo in macchina CL.indd",
"0093L3 - Controllo in macchina CE.indd",
"0093L1 - Quadro elettrico 700.indd",
"0093L1 - Quadro elettrico 600.indd"
]
//-----
// File lavaggio 2 zone da non modificare automaticamente
var fileLavaggio2Zone = [
"0093L2 - TB2000 + RX.indd",
"0093L2 - TB2000.indd"
]
//-----
// Funzioni
function ManutenzioneMaster(){
var myFolder = Folder(ManutenzionePath);
if (myFolder != null) {
var myFiles = [];
myFiles = myFolder.getFiles("*.indd");
for (var i = 0; i < myFiles.length; i++) {
var myFile = myFiles[i];
app.open(myFile);
}
}
for(var e = 0; e < app.documents.length; e++){
var documento = app.documents[e];
if (documento.name !== filesManutenzioneDPI){
documento.loadMasters(masterManutenzionePath, GlobalClashResolutionStrategyForMasterPage.LOAD_ALL_WITH_OVERWRITE);
}
else {
documento.loadMasters(masterManutenzioneDPIPath, GlobalClashResolutionStrategyForMasterPage.LOAD_ALL_WITH_OVERWRITE);
}
}
var documentiDaChiudere = [];
for (var c = 0; c < app.documents.length; c++) {
var documentoAperto = app.documents[c];
var nomeFile = documentoAperto.name;
documentoAperto.save();
documentiDaChiudere.push(documentoAperto);
}
for (var j = 0; j < documentiDaChiudere.length; j++) {
var documentoDaChiudere = documentiDaChiudere[j];
documentoDaChiudere.close(SaveOptions.NO);
}
}
// DIALOG
// ======
var dialog = new Window("dialog");
dialog.text = "Pagine principali V1.0";
dialog.preferredSize.width = 134;
dialog.orientation = "column";
dialog.alignChildren = ["center","top"];
dialog.spacing = 10;
dialog.margins = 16;
var Movin = dialog.add("button", undefined, undefined, {name: "Movin"});
Movin.text = "Movin";
//Movin.onClick = function(){
//dialog.close();
//}
var Manutenzione = dialog.add("button", undefined, undefined, {name: "Manutenzione"});
Manutenzione.text = "Manutenzione";
Manutenzione.onClick = function(){
dialog.close();
//ManutenzioneMaster();
}
dialog.show();
// ======
