Thsi is a quick throw-together, it should work. If you want to change the delay, change the amount (milliseconds) in line 44 : pausecomp(1000)
#target illustrator
processObjects(app.documents, processDocument, noFiles);
function processObjects(theObjects, theMainFunction, theAlternateFunction) {
var returnValue = null;
if (theObjects == undefined) {
alert ('Undefined??')
returnValue = ''
} else {
if (theObjects.length ==0) {
if (!(theAlternateFunction == undefined) && !(theAlternateFunction == null) && !(theAlternateFunction == '')) {
returnValue = theAlternateFunction (theObjects.parent);
}
} else {
if (!(theMainFunction == undefined) && !(theMainFunction == null) && !(theMainFunction == '')) {
// returnValue = new Array;
for (var i = theObjects.length -1; i> -1; i--) {
returnValue += theMainFunction (theObjects, i);
}
}
}
}
return returnValue;
}
function processDocument(docRef, i) {
app.activeDocument = docRef
processObjects(docRef.layers, processLayer, null);
alert ('File "' + docRef.name + '" Completed.')
}
function processLayer(layertRef, i) {
// Check all groups on layer
processObjects(layertRef.pathItems, processGroup, null);
return 0
}
function processGroup(objectRef, i) {
objectRef.hidden = false
app.redraw()
pausecomp(1000)
return 0
}
function noFiles (objectRef) {
var userChoice = confirm ('No files open.\nSelect a file to process?')
// Allow selection of files?
if (userChoice) {
var theFilePath = File.openDialog ('Select a file:')
if (theFilePath != null) {
x = openFile (theFilePath)
if (x) {
processObjects(app.documents, processDocument, noFiles);
}
}
}
}
function pausecomp(millis)
{
var date = new Date();
var curDate = null;
do { curDate = new Date(); }
while(curDate-date < millis);
}