728x90

<출처>http://blog.naver.com/siriuszw/20028801201

 
Source Insight에서 매크로 기능을 활용하여 주석(//)을 쉽게 추가할 수 있는 방법입니다.여러 라인을 //
주석을 통하여 단축키로 한번에 설정할 수 있는 기능입니다.
다른 분들도 사용해 보시면 많이 편해지시지 않을까해서 올려봅니다.


- 주석 설정 매크로 작성법
: 주석을 붙이고자 하는 위치에서 [CTRL+SHIFT+/]키를 누르면 주석 처리가 될 수 있도록 합니다.
  //2003-12-16 김종설
  의 형태 현재 날짜를 기준으로 주석이 생성됩니다.

1. Source Insight에서 Project 메뉴 -> Open Project -> Base Project 를 Open합니다.

2. Base Project에 포함되어 있는 Utils.em 화일을 Open 합니다.

3. 다음과 같은 코드를 추가합니다.

macro InsertDateStart()
{
   stime = GetSysTime(true)
   username ="김종설 "
   hbuf = GetCurrentBuf()
   SetBufSelText(hbuf, "//[ ")
   SetBufSelText(hbuf, stime.Year)    // 2002-
   SetBufSelText(hbuf, "-")
   SetBufSelText(hbuf, stime.Month)  //  01-
   SetBufSelText(hbuf, "-")
   SetBufSelText(hbuf, stime.Day)     //  17
   SetBufSelText(hbuf, " ")
   SetBufSelText(hbuf, username)
}

4. 화일을 저장합니다.

5. Option 메뉴 -> Key assignment 선택

6. Command에서 Macro로 검색 후 입력한 매크로 함수명[ Macro: InsertDateStart() ]을 선택

7. Assign New Key 버튼을 누른후 키(CTRL+SHIFT+/) 할당 후 OK
   : 키 할당은 사용자의 편의에 맞게 설정하세요.

8. 주석을 넣고자 하는 부분에서 할당한 키(CTRL+SHIFT+/)를 누르면
   // 2003-12-16 김종설
   과 같이 주석이 생성됩니다. 내용은 직접입력해 주시면 됩니다.

그럼 많은 도움이 되셨으면 합니다.  
 

--------------------------------------------------------------------------------

예)
 
macro InsertDateStart()
{
   stime = GetSysTime(true)
  
   _modelname  = "LEO"
   _username  = "KIMJUNGMIN"
   _year   = "06"
   _dash  = "_"
 
   hbuf = GetCurrentBuf()
 
   SetBufSelText(hbuf, "/* ")
   SetBufSelText(hbuf, _modelname)
   SetBufSelText(hbuf, _dash)
   SetBufSelText(hbuf, _username)
   SetBufSelText(hbuf, _dash)  
 
   SetBufSelText(hbuf, _year)  
 
   if ( strlen(stime.Month)== 1)  // Month
    SetBufSelText(hbuf, "0")   // 0
   SetBufSelText(hbuf, stime.Month)  //
 
   if ( strlen(stime.Day)== 1)   // Day
    SetBufSelText(hbuf, "0")  // 0
   SetBufSelText(hbuf, stime.Day) 
  
   SetBufSelText(hbuf, " */")
}