나눔터  
  HOME > 나눔터 > 묻고답하기 > 엑셀
엑셀
엑셀에 대한 질문과 답변을 올려주세요. 단, 취지에 맞지 않는 글은 운영자가 삭제합니다.
 "000 님, 도와주세요", "부탁 드립니다.", "급합니다!" 등과 같이 막연한 제목을 달지 말아주세요.
[필독] 빠르고 정확한 답변을 얻는 16가지 Tip !
[필독] 저작권법 개정에 따른 이용안내

작성자:  

 박기남 (photomate)

추천:  2
파일:     KT.jpg (849.8KB) 조회:  2043
제목:   포토샵 파일이름삽입 스크립트
     
  // this script is a variation of the script addTimeStamp.js that is installed with PH7

if ( documents.length > 0 )
{
var originalDialogMode = app.displayDialogs;
app.displayDialogs = DialogModes.ERROR;
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.MM;

try
{
var docRef = activeDocument;

// Now create a text layer at the front
var myLayerRef = docRef.artLayers.add();
myLayerRef.kind = LayerKind.TEXT;
myLayerRef.name = "Filename";
         imgWidth = docRef.width
         imgHeight = docRef.height
var myTextRef = myLayerRef.textItem;

// strip the extension off
var fileNameNoExtension = docRef.name;
fileNameNoExtension = fileNameNoExtension.split( "." );
if ( fileNameNoExtension.length > 1 ) {
fileNameNoExtension.length--;
}
fileNameNoExtension = fileNameNoExtension.join(".")  + imgWidth
        
        
        

            
myTextRef.contents = fileNameNoExtension 
        
// off set the text to be in the middle
myTextRef.position = new Array( docRef.width / 2, docRef.height / 2 );
myTextRef.font = "Gulim";
         myTextRef.size = 14.4;
}
catch( e )
{
// An error occurred. Restore ruler units, then propagate the error back
// to the user
preferences.rulerUnits = originalRulerUnits;
        app.displayDialogs = originalDialogMode;
throw e;
}

// Everything went Ok. Restore ruler units
preferences.rulerUnits = originalRulerUnits;
app.displayDialogs = originalDialogMode;
}
else
{
alert( "You must have a document open to add the filename!" );
}

포토샵에서 이미지 하단에 파일이름 및 사이즈 정보를 출력하는 스크립트를 
제작하는 중입니다
파일이름 + 가로높이 + 세로높이 (mm) 로 노출되고자 하는데
소수점 아래까지 나와서 이 부분을 해결하고자 합니다
전문가들께 조언을 구하고자 합니다
감사합니다
 
[불량 게시물 신고]  
voice
fileNameNoExtension = fileNameNoExtension.join(".")  + imgWidth 
위부분을  아래로 대체하면  파일명 가로×세로 로  표시가 됨니다.

fileNameNoExtension =[ fileNameNoExtension, imgWidth].join(" ")   ;
fileNameNoExtension=fileNameNoExtension.substr(0,fileNameNoExtension.indexOf(".")-1);
fileNameNoExtension =[ fileNameNoExtension,imgHeight].join("×")   ;   
fileNameNoExtension=fileNameNoExtension.substr(0,fileNameNoExtension.indexOf(".")-1);

04-15 (11:34)
삭제 ■신고
        
  

작성일 : 2021-04-14(20:30)
최종수정일 : 2021-04-14(20:30)