(function() {
    try {
        app.beginUndoGroup("Reveal Selected Layers");
        // Deselect all the item
        if (app.project.selection != null)
            for (i = app.project.selection.length - 1; i >= 0; i--)
                app.project.selection[i].selected = false;

        // Select items which are selected
        var proj = app.project;
        var comp = proj.activeItem;
        if (comp) {
            var selectedLayers = comp.selectedLayers;
            if (selectedLayers.length > 0) {
                for (var l = 0; l < selectedLayers.length; l++) {
                    source = selectedLayers[l].source
                    if (source !== null) source.selected = true;
                }
            }
        }

    } catch (err) {
        alert(err);
    } finally {
        app.endUndoGroup();
    }
})();