
제목 : [수정] 복사[_이동,_no확장자]_for우메뉴.ahk
청락메모장 열고,
복사, 붙여넣기
파일이름 = 복사[_이동,_no확장자]_for우메뉴.ahk , 모든파일 , UTF8로 저장
참고사이트 https://www.autohotkey.com/boards/viewtopic.php?style=7&t=62064
수정사항 ---> 000.reg 파일 우메뉴에 중복 제거
필수파일(배치파일 실행) TF.7z
파일 받으신 분들 맨 아래
"HKCR\regfile\shell\CopyMoveTo", 지우고 사용하세요. 죄송 ㅠㅠ
;---------------------------------------------------------------------------------------------------------------------
#NoEnv
#NoTrayIcon
SetBatchLines -1
if (!A_IsAdmin)
RunAsAdmin()
if (!FileExist(A_WinDir "\복사_이동.ahk"))
{
MsgBox, 0x21, Add Context Menu : -- 복사_이동 --, [-- 복사_이동 --]을 [우메뉴]에 <등록> 할까요?
IfMsgBox Cancel
ExitApp
MsgBox,,-- 복사_이동 --, % AddScript(), 1
} else {
MsgBox, 0x21, Remove Context Menu : -- 복사_이동 --, [-- 복사_이동 --]을 [우메뉴]에서 <제거> 할까요?
IfMsgBox Cancel
ExitApp
MsgBox,,-- 복사_이동 --, % AddScript(1), 1
}
exitapp
RunAsAdmin() {
if (!A_IsCompiled) {
Run, *RunAs "%A_AhkPath%" /ErrorStdOut "%A_ScriptFullPath%"
} else {
Run, *RunAs "%A_ScriptFullPath%"
}
ExitApp
}
AddScript(rm=0) {
Static Script, Script2, RegKeys
Script =
(
#Include C:\Program Files\AutoHotkey\TF.ahk`n;#NoEnv`n#SingleInstance force`nIf !WinActive("ahk_exe explorer.exe")`nExitApp`nWinGetActiveTitle, WinTitle`n;10 번째 라인 수정(9 라인까지 수정불가)`ntarget_folders =`n(`nC:\`n)`nSendToPath = `%A_ScriptDir`%\복사_이동.ahk`nLoop, Parse, target_folders, ``n`nIf !FileExist(A_LoopField)`nFileCreateDir, `%A_LoopField`%`nGui, destroy`nGui, +AlwaysOnTop`nGui, Color, Black`nGui, Add, Button, x250 y20 w60 h16 gFadd, 대상 추가`nGui, Add, Button, x250 y50 w60 h16 gFdel, 목록 제거`nGui, Add, Button, x10 y30 w90 h24 gCopy, 복 사`nGui, Add, Button, x125 y30 w90 h24 gMove, 이 동`nGui, Add, Text, x10 y70 vStatus C2F171, 〔 추가, 제거시 〕다시 명령 내리세요.`nLoop, Parse, target_folders, ``n, ``r`n{`ny_pos := 70 + (A_Index * 25)`nGui, Add, CheckBox, x10 y`%y_pos`% vCh`%A_Index`% cYellow, `%A_LoopField`%`nI := A_Index`n}`nGui_height := 95+I*25`nGui, Show, h`%Gui_height`%, 복사 이동하기`nreturn`nCopy:`nGui, submit, nohide`nActivate(WinTitle " ahk_exe explorer.exe")`nSelection := Explorer_GetSelection()`nLoop `%I`%`n{`nGuiControlGet, checked,, Ch`%A_Index`%, Value`nIf (checked = 1)`n{`nGuiControlGet, folder,, Ch`%A_Index`%, Text`n{`nLoop, Parse, Selection, ``n`n{`nIf InStr(FileExist(A_LoopField), "D")`n{`nSplitPath, A_LoopField, SourceFolderName`nFileCopyDir, `%A_LoopField`%, `%folder`%\`%SourceFolderName`%, 1`n}`nelse`n{`nFileCopy, `%A_LoopField`%, `%folder`%\, 1`n}`nStatusMsg(". . . 복사 완료 . . .", 300, 200)`n}`n}`n}`n}`nExitApp`nreturn`nMove:`nGui, submit, nohide`nActivate(WinTitle " ahk_exe explorer.exe")`nSelection := Explorer_GetSelection()`nLoop `%I`%`n{`nGuiControlGet, checked,, Ch`%A_Index`%, Value`nIf (checked = 1)`n{`nGuiControlGet, folder,, Ch`%A_Index`%, Text`n{`nLoop, Parse, Selection, ``n`n{`nIf InStr(FileExist(A_LoopField), "D")`n{`nSplitPath, A_LoopField, SourceFolderName`nFileMoveDir, `%A_LoopField`%, `%folder`%\`%SourceFolderName`%, 1`n}`nelse`n{`nFileMove, `%A_LoopField`%, `%folder`%\, 1 `n}`nStatusMsg(". . . 이동 완료 . . .", 300, 200)`n}`n}`n}`n}`nExitApp`nreturn`nFadd:`nGui, submit, nohide`nGui, -AlwaysOnTop`nFileSelectFolder, target, *C:, 3, 추가 할 대상 폴더 선택 `nIf target<>`n{`nGuiControl,, DirSelect, `%target`%`nTF(SendToPath)`nt:=TF_InsertLine(t, 10, 10, target)`nTF_Save(t, SendToPath)`nSleep, 200`nreload`nreturn`n}`nGui, +AlwaysOnTop`nreturn`nFdel:`nGui, submit, nohide`nif I = 1`n{`nLoop `%I`%`n{`nGuiControl,, Ch`%A_Index`%, 0`nStatusMsg("대상폴더 하나는 유지하세요 . .", 1300, 500)`nreturn`n}`n}`nelse`n{`nLoop `%I`%`n{`nGuiControlGet, checked,, Ch`%A_Index`%, Value`nIf (checked = 1) `n{`nlinenumber := A_Index + 9`nTF(SendToPath)`nt:=TF_RemoveLines(t, linenumber, linenumber)`nTF_Save(t, SendToPath)`nreload`nreturn`n}`n}`n}`nreturn`nGuiClose:`nExitApp`nreturn `nActivate(title){`nWinActivate `%title`%`nWinWaitActive `%title`%, , 2`nIf ErrorLevel`n{`nMsgBox '`%title`%' not found.``n``nExiting script...`nExitApp`n}`n}`nExplorer_GetSelection(){`nWinGetClass, winClass, `% "ahk_id" . hWnd := WinExist("A")`nif !(winClass ~="Progman|WorkerW|(Cabinet|Explore)WClass")`nReturn`nshellWindows := ComObjCreate("Shell.Application").Windows`nif (winClass ~= "Progman|WorkerW")`nshellFolderView := shellWindows.FindWindowSW(0, 0, SWC_DESKTOP := 8, 0, SWFO_NEEDDISPATCH := 1).Document`nelse {`nfor window in shellWindows`ntry if (hWnd = window.HWND) && (shellFolderView := window.Document)`nbreak`n}`nfor item in shellFolderView.SelectedItems`nresult .= (result = "" ? "" : "``n") . item.Path`nif !result`nresult := shellFolderView.Folder.Self.Path`nReturn result`n}`nStatusMsg(msg, delay1, delay2)`n{`nGuiControl,, Status, `%msg`%`nSleep, `%delay1`%`nif (delay2 > 0) {`nGuiControl,, Status,`nSleep, `%delay2`%`n}}
)
Script2 =
(
#Include C:\Program Files\AutoHotkey\TF.ahk`n;#NoEnv`n#SingleInstance Force`nIf !WinActive("ahk_exe explorer.exe")`nExitApp`nWinGetActiveTitle, WinTitle`n;10 번째 라인 수정(9 라인까지 수정불가)`ntarget_folders =`n(`nC:\`n)`nSendToPath = `%A_ScriptDir`%\복사_no확장자.ahk`nLoop, Parse, target_folders, ``n`nIf !FileExist(A_LoopField)`nFileCreateDir, `%A_LoopField`%`nGui, destroy`nGui, +AlwaysOnTop`nGui, Color, Black`nGui, Add, Button, x250 y20 w60 h16 gFadd, 대상 추가`nGui, Add, Button, x250 y50 w60 h16 gFdel, 목록 제거`nGui, Add, Button, x70 y30 w110 h24 gMove, 복 사`nGui, Add, Text, x35 y70 vStatus C2F171, [ 확장자.맨.앞으로.복사본.만든_후___이동 ]`n Loop, Parse, target_folders, ``n, ``r`n{`n y_pos := 70 + (A_Index * 25)`nGui, Add, CheckBox, x10 y`%y_pos`% vCh`%A_Index`% cYellow, `%A_LoopField`%`n I := A_Index`n}`nGui_height := 95+I*25`nGui, Show, h`%Gui_height`%, [ 파일 안전 백업 ]`nreturn`nMove:`nGui, submit, nohide`nActivate(WinTitle " ahk_exe explorer.exe")`nSelection := Explorer_GetSelection()`nIf InStr(FileExist(Selection), "D")`n{`nStatusMsg(". . . 파일 만 이동 시킵니다 . . .", 2000, 500)`nExitApp`nreturn`n}`nLoop `%I`%`n{`nGuiControlGet, checked,, Ch`%A_Index`%, Value`nIf (checked = 1)`n{`nGuiControlGet, folder,, Ch`%A_Index`%, Text`n{`nLoop, Parse, Selection, ``n`n{`nsplitpath, A_LoopField, name, dir, ext, name_no_ext, drive`nExtens = `%dir`%\`%ext`%`%name_no_ext`%`nFileCopy, `%A_LoopField`%,`%Extens`%, 1`nFileMove, `%Extens`%, `%folder`%\, 1`nStatusMsg(". . . 복사 완료 . . .", 300, 200)`n}`n}`n}`n}`nExitApp`nreturn`nFadd:`nGui, submit, nohide`nGui, -AlwaysOnTop`nFileSelectFolder, target, *C:, 3, 추가 할 대상 폴더 선택`nIf target<>`n{`nGuiControl,, DirSelect, `%target`%`nTF(SendToPath)`nt:=TF_InsertLine(t, 10, 10, target)`nTF_Save(t, SendToPath)`nSleep, 200`nreload`nreturn`n}`nGui, +AlwaysOnTop`nreturn`nFdel:`nGui, submit, nohide`nif I = 1`n{`nLoop `%I`%`n{`nGuiControl,, Ch`%A_Index`%, 0`nStatusMsg("대상폴더 하나는 유지하세요 . .", 1000, 200)`nreturn`n}`n}`nelse`n{`nLoop `%I`%`n{`nGuiControlGet, checked,, Ch`%A_Index`%, Value`nIf (checked = 1)`n{`nlinenumber := A_Index + 9`nTF(SendToPath)`nt:=TF_RemoveLines(t, linenumber, linenumber)`nTF_Save(t, SendToPath)`nreload`nreturn`n}`n}`n}`nreturn`nGuiClose:`nExitApp`nreturn`nActivate(title){`nWinActivate `%title`%`nWinWaitActive `%title`%, , 2`nIf ErrorLevel`n{`nMsgBox '`%title`%' not found.``n``nExiting script...`nExitApp`n}`n}`nExplorer_GetSelection(){`nWinGetClass, winClass, `% "ahk_id" . hWnd := WinExist("A")`nif !(winClass ~="Progman|WorkerW|(Cabinet|Explore)WClass")`nReturn`nshellWindows := ComObjCreate("Shell.Application").Windows`nif (winClass ~= "Progman|WorkerW")`nshellFolderView := shellWindows.FindWindowSW(0, 0, SWC_DESKTOP := 8, 0, SWFO_NEEDDISPATCH := 1).Document`nelse {`nfor window in shellWindows`ntry if (hWnd = window.HWND) && (shellFolderView := window.Document)`nbreak`n}`nfor item in shellFolderView.SelectedItems`nresult .= (result = "" ? "" : "``n") . item.Path`nif !result`nresult := shellFolderView.Folder.Self.Path`nReturn result`n}`nStatusMsg(msg, delay1, delay2)`n{`nGuiControl,, Status, `%msg`%`nSleep, `%delay1`%`nif (delay2 > 0) {`nGuiControl,, Status,`nSleep, `%delay2`%`n }}
)
RegKeys =
(
REG_SZ|HKCR\*\shell\CopyMoveTo|MUIVerb|-- 복사_이동 --`nREG_SZ|HKCR\*\shell\CopyMoveTo|icon|WLIDCLI.DLL,-1008`nREG_SZ|HKCR\*\shell\CopyMoveTo|Position|top`nREG_SZ|HKCR\*\shell\CopyMoveTo|SubCommands`nREG_SZ|HKCR\*\shell\CopyMoveTo|NoWorkingDirectory`nREG_SZ|HKCR\*\shell\CopyMoveTo\shell\복사_이동||-- 복사_이동 --`nREG_SZ|HKCR\*\shell\CopyMoveTo\shell\복사_이동|icon|WLIDCLI.DLL,-1008`nREG_SZ|HKCR\*\shell\CopyMoveTo\shell\복사_이동\Command||"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%A_WinDir%\복사_이동.ahk"`nREG_SZ|HKCR\*\shell\CopyMoveTo\shell\복사_no확장자||-- 복사_no확장자 --`nREG_SZ|HKCR\*\shell\CopyMoveTo\shell\복사_no확장자|icon|TWINUI.DLL,-9603`nREG_SZ|HKCR\*\shell\CopyMoveTo\shell\복사_no확장자\Command||"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%A_WinDir%\복사_no확장자.ahk"`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo|MUIVerb|-- 복사_이동 --`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo|icon|WLIDCLI.DLL,-1008`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo|Position|top`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo|SubCommands`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo|NoWorkingDirectory`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo\shell\복사_이동||-- 복사_이동 --`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo\shell\복사_이동|icon|WLIDCLI.DLL,-1008`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo\shell\복사_이동\Command||"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%A_WinDir%\복사_이동.ahk"`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo\shell\복사_no확장자||-- 복사_no확장자 --`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo\shell\복사_no확장자|icon|TWINUI.DLL,-9603`nREG_SZ|HKCR\AutoHotkeyScrip\shell\CopyMoveTo\shell\복사_no확장자\Command||"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%A_WinDir%\복사_no확장자.ahk"`nREG_SZ|HKCR\Directory\shell\CopyMoveTo|MUIVerb|-- 복사_이동 --`nREG_SZ|HKCR\Directory\shell\CopyMoveTo|icon|WLIDCLI.DLL,-1008`nREG_SZ|HKCR\Directory\shell\CopyMoveTo|Position|top`nREG_SZ|HKCR\Directory\shell\CopyMoveTo|SubCommands`nREG_SZ|HKCR\Directory\shell\CopyMoveTo|NoWorkingDirectory`nREG_SZ|HKCR\Directory\shell\CopyMoveTo\shell\복사_이동||-- 복사_이동 --`nREG_SZ|HKCR\Directory\shell\CopyMoveTo\shell\복사_이동|icon|WLIDCLI.DLL,-1008`nREG_SZ|HKCR\Directory\shell\CopyMoveTo\shell\복사_이동\Command||"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%A_WinDir%\복사_이동.ahk"`nREG_SZ|HKCR\Directory\shell\CopyMoveTo\shell\복사_no확장자||-- 복사_no확장자 --`nREG_SZ|HKCR\Directory\shell\CopyMoveTo\shell\복사_no확장자|icon|TWINUI.DLL,-9603`nREG_SZ|HKCR\Directory\shell\CopyMoveTo\shell\복사_no확장자\Command||"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%A_WinDir%\복사_no확장자.ahk"`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo|MUIVerb|-- 복사_이동 --`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo|icon|WLIDCLI.DLL,-1008`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo|Position|top`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo|SubCommands`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo|NoWorkingDirectory`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo\shell\복사_이동||-- 복사_이동 --`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo\shell\복사_이동|icon|WLIDCLI.DLL,-1008`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo\shell\복사_이동\Command||"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%A_WinDir%\복사_이동.ahk"`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo\shell\복사_no확장자||-- 복사_no확장자 --`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo\shell\복사_no확장자|icon|TWINUI.DLL,-9603`nREG_SZ|HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo\shell\복사_no확장자\Command||"C:\Program Files\AutoHotkey\AutoHotkey.exe" "%A_WinDir%\복사_no확장자.ahk"
)
If (!rm) {
FileAppend, %Script%, %A_WinDir%\복사_이동.ahk,utf-8
FileAppend, %Script2%, %A_WinDir%\복사_no확장자.ahk,utf-8
Loop, parse, RegKeys, `n
{
Type := Key := Name := Value := ""
loop, parse, A_LoopField, |
{
if (A_Index = 1)
Type := LTrim(A_Loopfield)
else if (A_Index = 2)
Key := LTrim(A_Loopfield)
else if (A_Index = 3)
Name := LTrim(A_Loopfield)
else if (A_Index = 4)
Value := LTrim(A_Loopfield)
}
RegWrite, %Type%, %Key%, %Name%, %Value%
}
str := "설치 완료!"
} else {
FileDelete, %A_WinDir%\복사_이동.ahk
FileDelete, %A_WinDir%\복사_no확장자.ahk
For i, path in ["HKCR\*\shell\CopyMoveTo", "HKCR\AutoHotkeyScript\shell\CopyMoveTo", "HKCR\Directory\shell\CopyMoveTo", "HKCR\regfile\shell\CopyMoveTo", "HKLM\SOFTWARE\Classes\SystemFileAssociations\document\shell\CopyMoveTo"]
RegDelete, % path
str := "제거 완료!"
}
return str
}
;---------------------------------------------------------------------------------------------------------------------
수고 많으셨습니다. 감사합니다.