It is currently April 20th, 2024, 8:17 am

Efficiency in Button Making [Photoshop]

Tips and Tricks from the Rainmeter Community
Mr Random
Posts: 5
Joined: April 21st, 2012, 12:04 am

Efficiency in Button Making [Photoshop]

Post by Mr Random »

This is a trick I made yesterday to assist me in making many buttons at a time.
This tutorial is for photoshop, using scripts.
1. Create a layer set of whatever name you want, and within it create more groups that contain the imagesof the up, down, and over states:
ImageImage

(The tribes group contains the three copies)

2. Then use the script saveEachButton below.
3. The script will prompt you for the layer set name (mine is "Icons", but you can make it whatever you want).

The script will make visible each set of icons, then prompt you to save them.

4. Save each button where ever you put your skin assets.
5. Done!

Please give me constructive criticism on this tutorial, as this is my first. I also created these scripts.

Thank you.

Also below is a simpler script I made which saves each layer individually.

Since the .jsx files are not allowed, I will post the code here:
saveEachButton.jsx

Code: Select all

// saveEachButton script made by Mr Random
function saveEachButton() {
	var layerSetRef = app.activeDocument.layerSets.getByName(prompt("Pick the LayerSet containing the Buttons"));
	for ( var i = 0; i < layerSetRef.layerSets.length; i++ )
	{	
		layerSetRef.layerSets[i].visible = false;
	}
	for ( var i = 0; i < layerSetRef.layerSets.length; i++ )
	{
		app.activeDocument.activeLayer = layerSetRef.layerSets[i];
		app.activeDocument.activeLayer.visible = true;
		pngFile = new File("/saveEach/" + activeDocument.activeLayer.name + ".png");
		pngSaveOptions = new PNGSaveOptions();
		pngSaveOptions.interlaced = false;
		app.activeDocument.saveAs(pngFile, pngSaveOptions);
		app.activeDocument.activeLayer.visible = false;
	}
	
}

saveEachButton();
saveEachLayer.jsx

Code: Select all

// saveEachLayer script made by Mr Random
function saveEach() {
	for ( var i = 0; i < app.activeDocument.artLayers.length; i++ )
	{
		app.activeDocument.artLayers[i].visible = false;
	}
	for ( var i = 0; i < app.activeDocument.artLayers.length; i++ )
	{
		app.activeDocument.activeLayer = app.activeDocument.artLayers[i];
		app.activeDocument.activeLayer.visible = true;
		pngFile = new File("/saveEach/" + activeDocument.activeLayer.name + ".png");
		pngSaveOptions = new PNGSaveOptions();
		pngSaveOptions.interlaced = false;
		app.activeDocument.saveAs(pngFile, pngSaveOptions);
		app.activeDocument.activeLayer.visible = false;
	}
	
}

saveEach();