 #target illustrator
//This file was autogenerated by BatchExportUI.jsx from wundes.com
// it is safe to erase, as it will be recreated the next time exportLayers.jsx is run.
var fileName = '';
doIt();
function doIt(){    
    // for each layer
    if(false){
        var allDocsLen = app.documents.length;
        while (allDocsLen--){
            app.documents[app.documents.length-1].activate();
            redraw();
            processDocument(app.documents[0]);
        }
    }else{
           processDocument(app.activeDocument);
    }
   }

function processDocument(currDoc){

    doc = currDoc;
    var len = doc.layers.length;
    var fname = doc.name;
    fname = fname.substr(0,fname.lastIndexOf("."));
    fileName = "Black Glass Template - Standard Buttons - Xtra Large" == "Black Glass Template - Standard Buttons - Xtra Large" ? fname : "Black Glass Template - Standard Buttons - Xtra Large";
    while (len--){
        
           //if layer isn't locked
        var thisLayer = doc.layers[len];
        if(thisLayer.locked == false){
            hideAllUnlocked();
            thisLayer.visible=true;
            app.redraw();


            var suffix =  true ? thisLayer.name:len;
            switch("PNG")
            {
                case "JPG":
                    exportJPG(suffix);
                    break;
                case "GIF":
                    exportGIF(suffix);
                    break;
                case"PNG":
                    exportPNG(suffix);
                    break;
                default:
                    break;
                
            }
            
            }
       }
}
function hideAllUnlocked(){
    var all = doc.layers.length;
    while(all--){
        if( doc.layers[all].locked==false){
        doc.layers[all].visible=false;
        }
     }
   }

function exportJPG(num){
     var exportOptions = new ExportOptionsJPEG();   
    var exportName = ("~/Documents/Core3%20UI%20Themes%20Assets/Xtra%20Large%20Black%20glass%20buttons"+"/"+ fileName+"_"+num);
    var dest = new File(exportName);
    var type = ExportType.JPEG;
    exportOptions.antiAliasing = true;
    exportOptions.qualitySetting = 85;
    exportOptions.optimization=true;
    exportOptions.artBoardClipping=true;

    doc.exportFile(dest,type,exportOptions);
    }
function exportGIF(num){
     var exportOptions = new ExportOptionsGIF(); 
    var exportName = ("~/Documents/Core3%20UI%20Themes%20Assets/Xtra%20Large%20Black%20glass%20buttons"+"/"+ fileName+"_"+num);
    var dest = new File(exportName);
    var type = ExportType.GIF;
     exportOptions.antiAliasing = true;
     exportOptions.artBoardClipping=true;
     exportOptions.transparency=true ;
    doc.exportFile(dest,type,exportOptions);
    }
function exportPNG(num){
     var exportOptions = new ExportOptionsPNG24();  
    var exportName = ("~/Documents/Core3%20UI%20Themes%20Assets/Xtra%20Large%20Black%20glass%20buttons"+"/"+ fileName+"_"+num);
    var dest = new File(exportName);
    var type = ExportType.PNG24;
     exportOptions.antiAliasing = true;
     exportOptions.artBoardClipping=true;
     exportOptions.transparency=true ;
    doc.exportFile(dest,type,exportOptions); 
    }