Indesign progress bar doesn't show value
Hi, guys!
I am trying to create a script that is searching for some images in over 100 fodlers. Since it takes much time to complete it, it would be nice the user to have a progress bar. I read the documentation for indesign scripting and also searched for some pregress bar scripting examples over the web, but it still seems I am doing somethig wrong - my progress bar does not show value.
I tried to:
alert the value of the progress bar, just to see if it is changeing - it does;
tried to hide/show the progress bar, hoping that it will refresh and will change it's value - still doesn't;
tried to use window.update() method - still nothing;
I even set a value bigger than 0 in the beginning just to see if is shows something, but it stil doesn't work...
Can some more experienced than me (I am relatively new to scripting) have a look at the code and maybe point out my mistake?
var ArchCats = ArchFolder.getFiles()
var ProgBarWin = new Window("window","Progress",[0,0,500,150])
ProgBarWin.CatProgText = ProgBarWin.add("statictext",[50,20,450,40],"")
ProgBarWin.ProgText = ProgBarWin.add("statictext",[50,60,450,80],"")
ProgBarWin.progBar = ProgBarWin.add("progressbar",[50,100,450,130],0,ArchCats.length)
ProgBarWin.center()
ProgBarWin.show()
for (j=0;j<ArchCats.length;j++) {
ProgBarWin.CatProgText.text = "Searching cat "+j+" out of "+ArchCats.length
ProgBarWin.progBar.value = j+1
var ArchCat = ArchCats[j]
if (ArchCat instanceof Folder) {
var _sentFolders = ArchCat.getFiles("_sent")
if (_sentFolders.length<1){
alert("There is no _sent folder in catalog "+ArchCat.name+" It will not be processed")
continue;
}
else {
var ArchPages = _sentFolders[0].getFiles()
for (arp = 0;arp<ArchPages.length;arp++) {
ProgBarWin.ProgText.text = "Searching page "+arp+" out of "+ArchPages.length
DefineFoldersAndSearch(ArchPages[arp])
}
}
}
}
Thanks in advance,
Denis.
