본문 바로가기

Prince evilstupidmiserable little

목록 파일 안에서 빈 파일 만들기

; 목록 파일에서 커서를 놓은 해당 줄의 파일명에 연속된 파일 만들기
; 해당 줄에 있는 경로가 포터블환경에서 다른 드라이브, 다른 경로에 있는 것과 관계없이, 무조건 목록 파일이 들어 있는 폴더 안에 해당 파일 이름에 부속된_파일을 생성함
; 원하는 경우에는 해당 파일을 다른 폴더로 옮겨야 한다.

#IfWinActive, EditPlus
#4::
Sleep, 500 ; 0.5 초 정도 여유를 두고 다음 명령을 실행한다.
Sendinput, {Home} ; {Home} 키를 문서창에 보낸다.
Sleep, 50
Sendinput, {Home}{Shift Down}{end}{Shift Up}
Sleep, 50
Sendinput, {LCtrl Down}c{LCtrl Up}
Sleep, 50
Sendinput, {LCtrl Down}c{LCtrl Up}
Sleep, 50
Sendinput, {LCtrl Down}c{LCtrl Up}
Sleep, 500
Sendinput, {home}{home}
sleep, 50
AAA = %Clipboard%
Clipboard=
;StringSplit, OutputArray, InputVar [, Delimiters, OmitChars]
StringSplit, nwordarray, AAA, :
; 해당 줄이 경로가 기재되지 않은 순수한 주석줄인 경우 실행하지 않음
if nwordarray0 < 2
{
return
}

; 기재된 파일의 드라이브명
StringRight, ndrrive, nwordarray1, 1
; SplitPath, InputVar [, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive]
SplitPath, nwordarray2, nOFN, nOD, nOE, nONNEt, nODr
nnewfiledir = %ndrrive%:%nOD%\%nOFN%


; 목록 파일이 위치한 드라이브명
WinGetActiveTitle, portpath
; msgbox, portpath = %portpath%
StringSplit, pwordarray, portpath, :
StringRight, pdrrive, pwordarray1, 1

SplitPath, pnwordarray2, pOFN, pOD, pOE, pONNEt, pODr
; SplitPath, InputVar [, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive]

; 기재된 경로가 웹주소인 경우
StringRight, httpr, nwordarray1, 4
if httpr = http
{
downfile = %pdrrive%:%pOD%\http-%nwordarray2%
StringReplace, downfile, downfile, ?, _, All
StringReplace, downfile, downfile, /, -, All

MsgBox , 1, 안내, http:%nwordarray2%을 %downfile% 파일로 다운받으시겠습니까, 25
ifmsgbox, ok
UrlDownloadToFile, http:%nwordarray2%, %downfile%
return
}


StringRight, ftpr, nwordarray1, 3
if ftpr = ftp
{
downfile = %pdrrive%:%pOD%\ftp-%nwordarray2%
StringReplace, downfile, downfile, ?, _, All
StringReplace, downfile, downfile, /, -, All

MsgBox , 1, 안내, http:%nwordarray2%을 %downfile% 파일로 다운받으시겠습니까, 25
ifmsgbox, ok
UrlDownloadToFile, http:%nwordarray2%, %downfile%
return
}


; msgbox, 목록 파일이 위치한 드라이브명 %pdrrive% 기재된 파일의 드라이브명= %ndrrive%
If pdrrive <> %ndrrive%
driveinfo = 현재 목록파일이 위치한 드라이브와 기재된 파일의 드라이브가 일치하지 않습니다.`n이 경우 목록파일이 위치한 드라이브에 빈 파일을 생성합니다.`n

; %nODr%%nONNEt% ; 확장자만 삭제한 파일경로

InputBox, Countt, 안내, %driveinfo%현재 파일이 위치한 폴더내에 %pdrrive%:%nOD%\%nOFN% 파일에 부가된 빈파일을 생성하고 목록에 기재합니다. `n입력창에 만들기 원하는 파일갯수를 넣어주십시오.`n또한 Editplus에서 줄 삽입(insert)을 잠그시거나 아니면 새 파일 경로가 기재될 줄에 해당한 공간을 만들어주십시오`n파일명은 현재 커서에 놓인 파일명 %OD%\%ONNEt%_0000.%OE% 형태로 기초적으로 생성됩니다.`n다만 생성된 빈파일의 파일명은 작업이 완료된 후 생성된 파일들을 블록설정한 후 CTRL+M을 눌러 작업하면`n다시 원하는 형태로 변경 사용가능합니다.`n, , 800, 300, , , , 25, 10
if ErrorLevel = 1
return
if ErrorLevel = ERROR
{
return
}
InputBox, basicformat, 안내, %pdrrive%:%nOD%\%nOFN% 파일에 부가된 빈파일을 생성할 때 사용할 기본 포맷문서[예: basic.htm]를 지정해 주십시오. `n특별히 지정하지 않으면`, %pdrrive%:%nOD%\%nOFN% 가 있는 경우 이를 기본 포맷으로 하여 생성합니다.`n 이 파일에 내용이 들어 있을 때는 그 내용까지 함께 복사됩니다.`n`n, , 800, 300, , , , 25, %pdrrive%:%nOD%\%nOFN%
if ErrorLevel = 1
return
if ErrorLevel = ERROR
{
return
}

ifexist, %basicformat%
{
Loop, %Countt%
{
if a_index Between 1 And 9
{
Clipboard= %nONNEt%_000%a_index%.%nOE% 빈문서_000%a_index% %pdrrive%:%nOD%\%nONNEt%_000%a_index%.%nOE%
Sendinput, {home}{home}
sleep, 50
Sendinput, {down}{enter}{up}
sleep, 50
Sendinput, ^v
FileCopy, %basicformat%, %pdrrive%:%nOD%\%nONNEt%_000%a_index%.%nOE%
}
if a_index Between 10 And 99
{
Clipboard= %nONNEt%_00%a_index%.%nOE% 빈문서_00%a_index% %pdrrive%:%nOD%\%nONNEt%_00%a_index%.%nOE%
Sendinput, {home}{home}
sleep, 50
Sendinput, {down}{enter}{up}
Sendinput, ^v
FileCopy, %basicformat%, %pdrrive%:%nOD%\%nONNEt%_00%a_index%.%nOE%
}
if a_index Between 100 And 999
{
Clipboard= %nONNEt%_0%a_index%.%nOE% 빈문서_0%a_index% %pdrrive%:%nOD%\%nONNEt%_0%a_index%.%nOE%
Sendinput, {home}{home}
sleep, 50
Sendinput, {down}{enter}{up}
Sendinput, ^v
FileCopy, %basicformat%, %pdrrive%:%nOD%\%nONNEt%_0%a_index%.%nOE%
}
if a_index > 999
{
Clipboard= %nONNEt%_%a_index%.%nOE% 빈문서_%a_index% %pdrrive%:%nOD%\%nONNEt%_%a_index%.%nOE%
Sendinput, {home}{home}
sleep, 50
Sendinput, {down}{enter}{up}
Sendinput, ^v
FileCopy, %basicformat%, %pdrrive%:%nOD%\%nONNEt%_%a_index%.%nOE%
}
} ; loop
}
ifnotexist, %basicformat%
{
MsgBox, 0, 안내, 빈파일을 생성할 기본 포맷 문서 %basicformat%이 폴더 안에 없습니다.`n생성할 파일에 사용할 기본 포맷문서를 정하고 다시 실행해 주십시오, 10
}
return


; 목록파일안에서 일기나, 간단한 새 파일을 새로 만들고 해당 내역을 기재하고 새 파일 편집하기.
#IfWinActive, EditPlus
#5::
WinGetActiveTitle, portpath
StringSplit, pwordarray, portpath, :
StringRight, pdrrive, pwordarray1, 1
;SplitPath, InputVar [, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive]
SplitPath, pwordarray2, OFN1, OD1, OE1, ONNEt1, ODr1
newfilename=%A_YYYY%-%A_MM%-%A_DD%-%A_DDD%-%A_Hour%%A_Min%%A_Sec%
ifexist, %pdrrive%:%OD1%\basic.htm ; 기본 포맷
{
Clipboard= %newfilename%.htm 메모 %pdrrive%:%OD1%\%newfilename%.htm
Sendinput, {home}{enter}{up}
sleep, 50
Sendinput, ^v
FileCopy, %pdrrive%:\%OD1%\basic.htm, %pdrrive%:%OD1%\%newfilename%.htm
sleep, 50
run, %out%:\totalcmd\Plugins\htmleditor\WizHtmlEditor.exe "%pdrrive%:%OD1%\%newfilename%.htm"
}
else
{
Clipboard= %newfilename%.txt 메모 %pdrrive%:%OD1%\%newfilename%.txt
Sendinput, {home}{enter}{up}
sleep, 50
Sendinput, ^v
run, %ProgramFiles%\EditPlus 3\editplus.exe %pdrrive%:%OD1%\%newfilename%.txt
sleep, 700
Sendinput, {enter}
}
return