Source:
;--- 특수문자 빠른 입력 함수
special_chars() {
Input, OutputVar, , {Enter} ;입력을 받습니다. Enter를 누르면 입력을 종료합니다.
Send {Alt Down}
Loop, parse, OutputVar ;입력된 문자열에서 문자 하나씩 루프를 돌립니다.
{
Send {Numpad%A_LoopField%} ;숫자에 해당하는 키패드 숫자를 출력합니다.
}
Send {Alt Up}
}
subMultiClipControl(sCmd, clipIndex=""){
static myClip1, myClip2, myClip3, myClip4, myClip5, myClip6, myClip7, myClip8, myClip9, myClip0
if(sCmd="copy" or sCmd="복사" or sCmd="cut" or sCmd="잘라내기"){
clipIndex:=_getValidClipIndex(clipIndex)
clipboard_bak:=ClipboardAll
clipboard:=""
sendPlay,% (sCmd="copy" or sCmd="복사") ? "^c" : "^x"
ClipWait,20 ,1
if(Not ErrorLevel){
myClip%clipIndex%:=ClipboardAll
soundBeep, 12000,80
}else
msgbox , 16, 복사 오류, multiClipControl()가 20초 내에 클립보드 복사수행을 완료하지 못했습니다.
clipboard:=clipboard_bak
}else if(sCmd="paste" or sCmd="붙이기"){
clipIndex:=_getValidClipIndex(clipIndex)
clipboard_bak:=ClipboardAll
clipboard:=myClip%clipIndex%
sendPlay, ^v
clipboard:=clipboard_bak
}else if(sCmd="clearAll" or sCmd="전부비우기"){
Loop, 10
{ clipIndex:=A_index-1
VarSetCapacity(myClip%clipIndex%, 0)
}
soundBeep, 12000,80
}else
msgbox , 16, sCmd 오류, [%sCmd%] 명령어는 지원하지 않습니다.
}
_getValidClipIndex(clipIndex){
if(clipIndex=""){
clipIndex:=subStr(A_thishotkey,0,1)
}
if clipIndex is not integer
{ msgbox , 16, 핫키정의 오류, multiClipControl() 함수를 사용하는 핫키명의 끝은 반드시 숫자로 끝나야 합니다.
Exit
}
if Not ( (clipIndex >= 0) And(clipIndex <= 9))
{ msgbox , 16, 클립번호 오류, 사용한 clipIndex=>%clipIndex% 은`n0에서 9 사이 정수가 아닙니다.
Exit
}
return clipIndex
}
subRegHotkey_exit( _newRegHotkey="" ){
global
local _eHotkey, _emptyIndex, KEY_INPUT_MS
KEY_INPUT_MS:=450 ; 키 누른 횟수를 검출할 시간(ms)으로 약 200~500ms 조절가능. 반응시간을 빠르게할려면 줄여야하고, 회수검출을 늘리려면 늘려야함.
MAX_KEY_BUF_SIZE:=8
if(_newRegHotkey="")
_newRegHotkey:=A_thisHotKey
loop %MAX_KEY_BUF_SIZE% { ; 버퍼에 이미등록된 핫키인지 조사
_eHotkey:=hList[%A_Index%]Hotkey
if(_eHotkey=""){
_emptyIndex:=A_index
}else{
if((_newRegHotkey=A_PriorHotkey) and (_newRegHotkey=_eHotkey) ){ ; 직전 핫키이면서 이미 목록에 등록되어 있다면 카운터만 증가시킨다.
hList[%A_Index%]keyCount++
Exit
}
}
}
if(_emptyIndex){ ; 비어있는 인덱스에 핫키 신규등록.
hList[%_emptyIndex%]time:=A_TickCount+KEY_INPUT_MS
hList[%_emptyIndex%]keyCount:=1
hList[%_emptyIndex%]Hotkey:=_newRegHotkey
}else{
OutputDebug, @Buffer full !!!
}
if(Not gBlnHotKeyTimerEnabled){ ; 타이머가 꺼져있다면 켬.
setTimer, tmrMThotkeyHandler, 20
gBlnHotKeyTimerEnabled:=True
}
Exit
}
; 타이머가 켜져있는동안 TimeOut 시간을 초과했는지 계속 검사한다.
; TimeOut 시간이 지났을 경우 해당 목록을 삭제, 해당 목록의 라벨로 gosub 시킴.
; 더이상 목록이 없을 경우 타이머 중지시킴.
subMThotkeyHandler(){
global ; MAX_KEY_BUF_SIZE
Local _emtpyListCount, _eHotkey, _index , _eTime
_emtpyListCount:=0
Loop %MAX_KEY_BUF_SIZE% {
_index:=MAX_KEY_BUF_SIZE-A_Index+1
_eHotkey:=hList[%_Index%]Hotkey
if(_eHotkey){ ;점프라벨이 할당되어있다면 Timeout 인지 조사
_eTime:= hList[%_Index%]time
if(A_TickCount>=_eTime){ ; Timeout
critical
gKeyCount:=hList[%_Index%]keyCount
gTime:=_eTime
gHotkey:=_eHotkey
gosub, %_eHotkey%
gKeyCount:=""
hList[%_Index%]Hotkey:=""
critical, off
}
}else{
_emtpyListCount++
}
}
if(_emtpyListCount=MAX_KEY_BUF_SIZE){ ; 빈목록 갯수면 타이머 중지시킴.
setTimer, tmrMThotkeyHandler, Off
gBlnHotKeyTimerEnabled:=False
}
}
special_chars() {
Input, OutputVar, , {Enter} ;입력을 받습니다. Enter를 누르면 입력을 종료합니다.
Send {Alt Down}
Loop, parse, OutputVar ;입력된 문자열에서 문자 하나씩 루프를 돌립니다.
{
Send {Numpad%A_LoopField%} ;숫자에 해당하는 키패드 숫자를 출력합니다.
}
Send {Alt Up}
}
subMultiClipControl(sCmd, clipIndex=""){
static myClip1, myClip2, myClip3, myClip4, myClip5, myClip6, myClip7, myClip8, myClip9, myClip0
if(sCmd="copy" or sCmd="복사" or sCmd="cut" or sCmd="잘라내기"){
clipIndex:=_getValidClipIndex(clipIndex)
clipboard_bak:=ClipboardAll
clipboard:=""
sendPlay,% (sCmd="copy" or sCmd="복사") ? "^c" : "^x"
ClipWait,20 ,1
if(Not ErrorLevel){
myClip%clipIndex%:=ClipboardAll
soundBeep, 12000,80
}else
msgbox , 16, 복사 오류, multiClipControl()가 20초 내에 클립보드 복사수행을 완료하지 못했습니다.
clipboard:=clipboard_bak
}else if(sCmd="paste" or sCmd="붙이기"){
clipIndex:=_getValidClipIndex(clipIndex)
clipboard_bak:=ClipboardAll
clipboard:=myClip%clipIndex%
sendPlay, ^v
clipboard:=clipboard_bak
}else if(sCmd="clearAll" or sCmd="전부비우기"){
Loop, 10
{ clipIndex:=A_index-1
VarSetCapacity(myClip%clipIndex%, 0)
}
soundBeep, 12000,80
}else
msgbox , 16, sCmd 오류, [%sCmd%] 명령어는 지원하지 않습니다.
}
_getValidClipIndex(clipIndex){
if(clipIndex=""){
clipIndex:=subStr(A_thishotkey,0,1)
}
if clipIndex is not integer
{ msgbox , 16, 핫키정의 오류, multiClipControl() 함수를 사용하는 핫키명의 끝은 반드시 숫자로 끝나야 합니다.
Exit
}
if Not ( (clipIndex >= 0) And(clipIndex <= 9))
{ msgbox , 16, 클립번호 오류, 사용한 clipIndex=>%clipIndex% 은`n0에서 9 사이 정수가 아닙니다.
Exit
}
return clipIndex
}
subRegHotkey_exit( _newRegHotkey="" ){
global
local _eHotkey, _emptyIndex, KEY_INPUT_MS
KEY_INPUT_MS:=450 ; 키 누른 횟수를 검출할 시간(ms)으로 약 200~500ms 조절가능. 반응시간을 빠르게할려면 줄여야하고, 회수검출을 늘리려면 늘려야함.
MAX_KEY_BUF_SIZE:=8
if(_newRegHotkey="")
_newRegHotkey:=A_thisHotKey
loop %MAX_KEY_BUF_SIZE% { ; 버퍼에 이미등록된 핫키인지 조사
_eHotkey:=hList[%A_Index%]Hotkey
if(_eHotkey=""){
_emptyIndex:=A_index
}else{
if((_newRegHotkey=A_PriorHotkey) and (_newRegHotkey=_eHotkey) ){ ; 직전 핫키이면서 이미 목록에 등록되어 있다면 카운터만 증가시킨다.
hList[%A_Index%]keyCount++
Exit
}
}
}
if(_emptyIndex){ ; 비어있는 인덱스에 핫키 신규등록.
hList[%_emptyIndex%]time:=A_TickCount+KEY_INPUT_MS
hList[%_emptyIndex%]keyCount:=1
hList[%_emptyIndex%]Hotkey:=_newRegHotkey
}else{
OutputDebug, @Buffer full !!!
}
if(Not gBlnHotKeyTimerEnabled){ ; 타이머가 꺼져있다면 켬.
setTimer, tmrMThotkeyHandler, 20
gBlnHotKeyTimerEnabled:=True
}
Exit
}
; 타이머가 켜져있는동안 TimeOut 시간을 초과했는지 계속 검사한다.
; TimeOut 시간이 지났을 경우 해당 목록을 삭제, 해당 목록의 라벨로 gosub 시킴.
; 더이상 목록이 없을 경우 타이머 중지시킴.
subMThotkeyHandler(){
global ; MAX_KEY_BUF_SIZE
Local _emtpyListCount, _eHotkey, _index , _eTime
_emtpyListCount:=0
Loop %MAX_KEY_BUF_SIZE% {
_index:=MAX_KEY_BUF_SIZE-A_Index+1
_eHotkey:=hList[%_Index%]Hotkey
if(_eHotkey){ ;점프라벨이 할당되어있다면 Timeout 인지 조사
_eTime:= hList[%_Index%]time
if(A_TickCount>=_eTime){ ; Timeout
critical
gKeyCount:=hList[%_Index%]keyCount
gTime:=_eTime
gHotkey:=_eHotkey
gosub, %_eHotkey%
gKeyCount:=""
hList[%_Index%]Hotkey:=""
critical, off
}
}else{
_emtpyListCount++
}
}
if(_emtpyListCount=MAX_KEY_BUF_SIZE){ ; 빈목록 갯수면 타이머 중지시킴.
setTimer, tmrMThotkeyHandler, Off
gBlnHotKeyTimerEnabled:=False
}
}
사용방법:
1. 입력위치에서 Scroll Lock
2. 위 표를 참조하여 키값 입력후 엔터
ex) Scroll Lock + 153 + Enter = ™
2. 위 표를 참조하여 키값 입력후 엔터
ex) Scroll Lock + 153 + Enter = ™
출처 : http://cafe.naver.com/autohotkey.cafe