수색…


소개

스크립트에서 작업 할 파일을 여는 다른 방법.

Windows 탐색기를 통해 파일 열기

스크립트 내에서 첫 번째 줄을 사용하여 처리 할 이름과 함께 첫 번째 변수 (이 예제에서는 %1% )를 저장하십시오. 예 : OpenWithFile = %1%

Windows를 통해이 스크립트로 파일을 열면 (MS Windows에서 임의의 파일을 마우스 오른쪽 단추로 클릭하고 '열기 ...'를 선택한 다음 script.exe와 같은 스크립트의 컴파일 된 버전을 선택하십시오) choosed 파일의 이름은 이 변수에 저장되므로 스크립트가 스크립트를 사용할 수 있습니다. 예:

OpenWithFile = %1%
if OpenWithFile !=
{
FileRead, content, %OpenWithFile%
msgbox %content%
return
}

SelectFile을 통해 파일 열기 대화 상자

다음 예제에서는 SelectFile 대화 상자를 가져 오는 단일 단추로 Gui를 만듭니다.

Gui, Loader: New 
Gui, Loader: Add, Button, Default Center w220 vLOAD, LOAD
Gui, Loader: Show, AutoSize Center, Loader

return

LoaderButtonLOAD:
FileSelectFile, LoadedFile, , , ,

if ErrorLevel=1
{
return
}

else
{
    FileRead, content, %LoadedFile%
    msgbox %content%    
}
return

Windows에서 파일 열기 n '끌어서 놓기

이 예제는 드래그 n 'Drop 이벤트에 새 비어있는 Gui를 만듭니다.

Gui, Dropper: New
Gui, Dropper: Font, s10 w700
Gui, Dropper: Add, Text, y80 vText1, Drag the files here
Gui, Dropper: Show, w200 h200 Center, Dropper

return

DropperGuiDropFiles:
DroppedFile:=A_GuiEvent

    FileRead, content, %DroppedFile%
    msgbox %content%    

return


Modified text is an extract of the original Stack Overflow Documentation
아래 라이선스 CC BY-SA 3.0
와 제휴하지 않음 Stack Overflow