select next folder not consecutive
So I have a UI with a button that when clicked it skips to the next folder. This works if you have consecutive folder numbers but sometimes the numbers are not consecutive. I need a way to select whatever is next. I will give you a snippet of what i am currently doing.
mySkipGroup.addBtn.onClick = function(){
myPgLoc=app.document.presentationPath.slice(0,-3);
myPgNum=app.document.presentationPath.slice(-3);
myPgNum=Number (myPgNum)+1;
myPgNum = myPgNum.toString();
if (myPgNum.length==3){
myPgNum=myPgNum;
}
if (myPgNum.length==2){
myPgNum=("0"+myPgNum);
}
if(myPgNum.length==1){
myPgNum=("00"+myPgNum);
}
if(pgInput.text!=""){
pgtoSkip=pgInput.text;
if (pgtoSkip.length==3){
pgtoSkip=pgtoSkip;
}
if (pgtoSkip.length==2){
pgtoSkip=("0"+pgtoSkip);
}
if(pgtoSkip.length==1){
pgtoSkip=("00"+pgtoSkip);
}
//alert(myPgLoc+pgtoSkip);
app.document.setPresentationMode("browser",myPgLoc+pgtoSkip);
}
else{
app.document.setPresentationMode("browser",myPgLoc+myPgNum);
}
}
the presentation Mode is looking for an exact location.
