// create a variable for the current doc var doc = app.activeDocument; ///////////////////////// // MAIN ///////////////////////// // suspendHistory method. Creates one history step named "Delete All Channels" from all steps inside the function named main(); doc.suspendHistory("Super-Flatten", "main()"); ///////////////////////// // FUNCTIONS ///////////////////////// // a container function for all the steps we want to collapse down into one history step using suspendHistory function main(){ // Flatten the layers if any doc.flatten(); // Remove all alpha channels doc.channels.removeAll(); // Remove all paths doc.pathItems.removeAll(); }