Hi nicosh, After minor changes, your script works with my batch processor. Note: the variable called ‘g’ is the only variable that is not allowed. It’s used for exchanging data between both scripts. So, I replaced it with ‘j’. Also, I changed the font to Minion Pro and the character style to None (I am on the English version). But ‘g.doc’ I left as it is: it’s the currently open document in the batch processor. Here are recommended settings: The result My version of the script: var i;
var j = {};
j.cajasTexto = g.doc.stories;
j.estilosParrafo = g.doc.paragraphStyles;
j.estilosCaracter = g.doc.characterStyles;
j.fuente = "Minion Pro";
j.estiloAplicado = j.estilosParrafo.itemByName("EW_Cat_03_Info_block");
j.estiloAplicadoDos = j.estilosParrafo.itemByName("EW_Cat_07_Bummer_info_block");
j.estiloAplicadoTres = j.estilosParrafo.itemByName("EW_Cat_07_Bummer_info_block_NO_RULE");
j.estiloCaracterAplicado = j.estilosCaracter.itemByName("[None]");
j.horas = [['1am', '1.00'], ['1:15am', '1.15'], ['1:30am', '1.30'], ['1:45am', '1.45'],
['2am', '2.00'], ['2:15am', '2.15'], ['2:30am', '2.30'], ['2:45am', '2.45'],
['3am', '3.00'], ['3:15am', '3.15'], ['3:30am', '3.30'], ['3:45am', '3.45'],
['4am', '4.00'], ['4:15am', '4.15'], ['4:30am', '4.30'], ['4:45am', '4.45'],
['5am', '5.00'], ['5:15am', '5.15'], ['5:30am', '5.30'], ['5:45am', '5.45'],
['6am', '6.00'], ['6:15am', '6.15'], ['6:30am', '6.30'], ['6:45am', '6.45'],
['7am', '7.00'], ['7:15am', '7.15'], ['7:30am', '7.300'], ['7:45am', '7.45'],
['8am', '8.00'], ['8:15am', '8.15'], ['8:30am', '8.30'], ['8:45am', '8.45'],
['9am', '9.00'], ['9:15am', '9.15'], ['9:30am', '9.30'], ['9:45am', '9.45'],
['10am', '10.00'], ['10:15am', '10.15'], ['10:30am', '10.30'], ['10:45am', '10.45'],
['11am', '11.00'], ['11:15am', '11.15'], ['11:30am', '11.30'], ['11:45am', '11.45'],
['1pm', '13.00'], ['1:15pm', '13.15'], ['1:30pm', '13.30'], ['1:45pm', '13.45'],
['2pm', '14.00'], ['2:15pm', '14.15'], ['2:30pm', '14.30'], ['2:45pm', '14.45'],
['3pm', '15.00'], ['3:15pm', '15.15'], ['3:30pm', '15.30'], ['3:45pm', '15.45'],
['4pm', '16.00'], ['4:15pm', '16.15'], ['4:30pm', '16.30'], ['4:45pm', '16.45'],
['5pm', '17.00'], ['5:15pm', '17.15'], ['5:30pm', '17.30'], ['5:45pm', '17.45'],
['6pm', '18.00'], ['6:15pm', '18.15'], ['6:30pm', '18.30'], ['6:45pm', '18.45'],
['7pm', '19.00'], ['7:15pm', '19.15'], ['7:30pm', '19.30'], ['7:45pm', '19.45'],
['8pm', '20.00'], ['8:15pm', '20.15'], ['8:30pm', '20.30'], ['8:45pm', '20.45'],
['9pm', '21.00'], ['9:15pm', '21.15'], ['9:30pm', '21.30'], ['9:45pm', '21.45'],
['10pm', '22.00'], ['10:15pm', '22.15'], ['10:30pm', '22.30'], ['10:45pm', '22.45'],
['11pm', '23.00'], ['11:15pm', '23.15'], ['11:30pm', '23.30'], ['11:45pm', '23.45'],
['12am', '12.00'], ['12:15am', '12.15'], ['12:30am', '12.30'], ['12:45am', '12.45'],
['12pm', '12.00'], ['12:15pm', '12.15'], ['12:30pm', '12.30'], ['12:45pm', '12.45'],];
j.diasSemana = [['(?<=(\\s|~=|-|\\())Mon', 'lu'],
['(?<=(\\s|~=|-|\\())Tue', 'ma'],
['(?<=(\\s|~=|-|\\())Wed', 'mié'],
['(?<=(\\s|~=|-|\\())Thu', 'ju'],
['(?<=(\\s|~=|-|\\())Fri', 'vi'],
['(?<=(\\s|~=|-|\\())Sat', 'sá'],
['(?<=(\\s|~=|-|\\())Sun', 'do']];
j.meses = [['(?<=(\\s|~=|-|\\())Jan', 'ene'],
['(?<=(\\s|~=|-|\\())Feb', 'feb'],
['(?<=(\\s|~=|-|\\())Mar', 'mar'],
['(?<=(\\s|~=|-|\\())Apr', 'abr'],
['(?<=(\\s|~=|-|\\())May', 'may'],
['(?<=(\\s|~=|-|\\())Jun', 'jun'],
['(?<=(\\s|~=|-|\\())Jul', 'jul'],
['(?<=(\\s|~=|-|\\())Aug', 'ago'],
['(?<=(\\s|~=|-|\\())Sep', 'sep'],
['(?<=(\\s|~=|-|\\())Oct', 'oct'],
['(?<=(\\s|~=|-|\\())Nov', 'nov'],
['(?<=(\\s|~=|-|\\())Dec', 'dic']];
j.otrosCambios = [['daily', 'todos los dÃas'], ['noon', 'mediodÃa'], ['midnight', 'medianoche'], ['then taxi', 'luego taxi'], ['last adm', 'última admisión'], ['public hols', 'festivos']];
//Set the find options.
app.findChangeGrepOptions.includeFootnotes = false;
app.findChangeGrepOptions.includeHiddenLayers = false;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeMasterPages = false;
cambiarTodosItem(j.horas);
cambiarTodosItem(j.diasSemana);
cambiarTodosItem(j.meses);
cambiarTodosItem(j.otrosCambios);
function cambiarTodosItem(myArray_param) {
for (i = 0; i < myArray_param.length; i++) {
cambiarItem(myArray_param, j.estiloAplicado); //******CAMBIAR
//Clear the find/change preferences after the search.
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
}
}
function cambiarItem(item_arr, estiloAplicado_param) {
app.findGrepPreferences.appliedParagraphStyle = estiloAplicado_param;
app.findGrepPreferences.appliedFont = j.fuente;
app.findGrepPreferences.appliedCharacterStyle = j.estilosCaracter.itemByName("[None]");
for (i = 0; i < item_arr.length; i++) {
app.findGrepPreferences.findWhat = item_arr[i][0];
app.changeGrepPreferences.changeTo = item_arr[i][1];
g.doc.changeGrep();
}
}
... View more