NIdentPic=3
NPic=10



%   This software is protected by german copyright and international treaties.             
%   Copyright 2004 Markus Junghöfer & Peter Peyk. All Rights Reserved.                     
%                                                                                          
%   THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE        
%   NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,    
%   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE    
%   OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
%   TRADEMARKS OR OTHER RIGHTS. COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT,       
%   INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE      
%   OR DOCUMENTATION.                                                                      
% Path='Paul:Movies:Mirror2:';
Path='Paul:User:Tobias:ValAroPos2Pic:';

for PicInd=1:NPic
	
	if PicInd<10
		OldFile=['000' int2str(PicInd) '.jpg'];
	elseif PicInd>9 & PicInd<100
		OldFile=['00' int2str(PicInd) '.jpg'];
	elseif PicInd>99 & PicInd<1000
		OldFile=['0' int2str(PicInd) '.jpg'];
	elseif PicInd>999 & PicInd<10000
		OldFile=[int2str(PicInd) '.jpg'];
	end
	%PicIndTmp=(PicInd-1).*NIdentPic+1;
	PicIndTmp=PicInd+210
	OldFilePath=['"' Path,OldFile '"']
	if PicIndTmp<10
		NewFile=['000' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>9 & PicIndTmp<100
		NewFile=['00' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>99 & PicIndTmp<1000
		NewFile=['0' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>999 & PicIndTmp<10000
		NewFile=[int2str(PicIndTmp) '.jpg'];
	end
	NewFile=['"' NewFile '"'];
	RenameResult = applescript('arename', 'itemName', OldFilePath, 'newName', NewFile);
	fprintf('Picture: %g of %g; \n',PicInd,NPic);
	fprintf('Result of arename:  '); fprintf(RenameResult); fprintf('\n');
	fprintf('Renamed File:  '); fprintf(NewFile); fprintf('\n');
end


NIdentPic=3
NPic=692
NewPath='Paul:Movies:Mirror2:';
OldPath='Paul:Movies:';
OldFile=['RedFix.jpg'];
OldFilePath=['"' OldPath,OldFile '"']

for PicInd=693:2*NPic
	PicIndTmp=(PicInd-1).*NIdentPic+2;
	NewFilePath=['"' NewPath,OldFile '"']
	CopyResult=applescript('acopy', 'itemName', OldFilePath,'folderName',['"' NewPath '"']);
	if PicIndTmp<10
		NewFile=['0000' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>9 & PicIndTmp<100
		NewFile=['000' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>99 & PicIndTmp<1000
		NewFile=['00' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>999 & PicIndTmp<10000
		NewFile=['0' int2str(PicIndTmp) '.jpg'];
	end
	NewFile=['"' NewFile '"'];
	RenameResult = applescript('arename', 'itemName', NewFilePath, 'newName', NewFile);
	fprintf('Picture: %g of %g; \n',PicInd,NPic);
	fprintf('Result of acopy:  '); fprintf(CopyResult); fprintf('\n');
	fprintf('Result of arename:  '); fprintf(RenameResult); fprintf('\n');
	fprintf('Renamed File:  '); fprintf(NewFile); fprintf('\n');
	
	
	PicIndTmp=(PicInd-1).*NIdentPic+3;
	NewFilePath=['"' NewPath,OldFile '"']
	CopyResult=applescript('acopy', 'itemName', OldFilePath,'folderName',['"' NewPath '"']);
	if PicIndTmp<10
		NewFile=['0000' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>9 & PicIndTmp<100
		NewFile=['000' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>99 & PicIndTmp<1000
		NewFile=['00' int2str(PicIndTmp) '.jpg'];
	elseif PicIndTmp>999 & PicIndTmp<10000
		NewFile=['0' int2str(PicIndTmp) '.jpg'];
	end
	NewFile=['"' NewFile '"'];
	RenameResult = applescript('arename', 'itemName', NewFilePath, 'newName', NewFile);
	fprintf('Picture: %g of %g; \n',PicInd,NPic);
	fprintf('Result of acopy:  '); fprintf(CopyResult); fprintf('\n');
	fprintf('Result of arename:  '); fprintf(RenameResult); fprintf('\n');
	fprintf('Renamed File:  '); fprintf(NewFile); fprintf('\n');
end
