Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Batch Processing

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I am looking for a way to convert a directory of images into thumbnail sized images and then place them all in a single PSD file.

I can batch process the size into a new folder but I am unable to find a way to get all the images into a single document. I have tried dragging them from explorer but that just opens the images up separately.

Ideally, I would like to do the whole process in one go but feel I am being a little optimistic about that being possible.

I am not even sure that this is possible but it would save me a lot of time if it were.

Any suggestions.

Keith
 
The following script will do that..

File - Scripts - Load Files into Stack..
 
Ah sorry, I have dug my old laptop out with CS2 on and this script should work for you.
You need to select the files in Bridge then run the script from Photoshop.
N.B. NO files should be open in Photoshop.
Code:
#target photoshop
main();
function main(){
var fileList = GetFilesFromBridge();
if(!fileList.length) return;
open(fileList.shift());
for(var a in fileList){
var doc = open(fileList[a]);
try{
doc.mergeVisibleLayers();
}catch(e){}
var Name = doc.name.replace(/\.[^\.]+$/, '');
activeDocument=documents[1];
activeDocument.activeLayer.duplicate(documents[0]);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); 
activeDocument.activeLayer.name = Name;
    }
}
function GetFilesFromBridge() {
	var fileList;
	if ( BridgeTalk.isRunning( "bridge" ) ) {
		var bt = new BridgeTalk();
		bt.target = "bridge";
		bt.body = "var theFiles = photoshop.getBridgeFileListForAutomateCommand();theFiles.toSource();";
		bt.onResult = function( inBT ) { fileList = eval( inBT.body ); }
		bt.onError = function( inBT ) { fileList = new Array(); }
		bt.send();
		bt.pump();
		$.sleep( 100 );
		var timeOutAt = ( new Date() ).getTime() + 5000;
		var currentTime = ( new Date() ).getTime();
		while ( ( currentTime < timeOutAt ) && ( undefined == fileList ) ) {
			bt.pump();
			$.sleep( 100 );
			currentTime = ( new Date() ).getTime();
		}
	}
	if ( undefined == fileList ) {
		fileList = new Array();
	}
	return fileList; 
}
Copy and paste the script into ExtendScript Toolkit, this gets installed with Photoshop

This utility can be found in the relevant folder:-
PC: C:\Program Files\Adobe\Adobe Utilities
MAC: <hard drive>/Applications/Utilities/Adobe Utilities

The script needs to be saved into:-
PC: C:\Program Files\Adobe\Adobe Photoshop CS2\Presets\Scripts
NB: Vista and Windows 7 you will have to save it elsewhere and copy it to this folder due to permissions.
MAC: <hard drive>/Applications/Adobe Photoshop CS2/ Presets/Scripts

If Photoshop was open, close and restart Photoshop so that it can pickup the new script.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top