매크로

조회 수 1091 추천 0 댓글 5

FTP 이용해서 다운로드 하는것 까지는 

소스를 완성했는데요.


다운로드 진행상황을 구현해보고 싶습니다.

이미지도 좋고 

백분율 표시도 좋고

총용량/받은용량 등으로 수치화 해도 좋구요.


혹시 비슷한 경험이 있으시거나

조언 주실수 있는 분 계실까요?


하나하나 필요한 것들 만들어 내다보니

엄청 재밌네요. ㅎ


시간탐험대를 요즘에 하는데

허접 매크로 나름 만들어 쓰고 있는데

자꾸 다른데로 눈이 가네요. 


조언 부탁드립니다.


  • profile
    외치기 2015.10.22 17:24

    FTP로 다운받는 소스가 어떤식으로 구성되있는지는 모르겠습니다만

    파일의 전체 용량과 현재 다운받은 용량을 알수있다면 Progress로 나타내는것도 괜찮을거같네요.

  • 단백질 2015.10.22 18:22

    제가 약 1달전에

    여기저기 뒤적거려가며 여러개를 토대로 만들어놓은게 있는데

    결과적으로는 실패를 했습니다.

    이유는

    다운로드진행창과 다 좋은데

    파일의 다운받은 용량이 바로바로 갱신이 되지 않고 일정시간이 지나야 갱신이 되는데,,

    갱신이 되야 Progress로 진행상태가 올라가는데 갱신이 될때까지 가만히있다가 실제 파일은 다운로드가 끝나버리더군요

    이걸 해결할 방법을 못찾았습니다.





    다운받는 방식은 똑같으나

    첫번두번째꺼는 스크립트작성시 미리 지정한 경로에만 다운이 가능하게 처음 만들었던거구요

    두번째는 좀더 편하게하려고 다운받을때 경로설정창이 떠 직접 다운받을 위치를 지정하게

    수정했습니다.


    한번 써보시고 개선가능하시면 개선해서좀 알려주세요 ㅎㅎ




    다운로드에 쓰인 파일은 알약니다.


    ==================================첫번째==================================

    Gui, Color, White

    Gui, Add, Progress, x5 y20 w350 h20 vPercent, 123

    Gui, Add, Text, x5 y45 w350 h15 cGreen vPercent2 +Center,

    Gui, Add, Text, x10 y60 w250 h20 cRed +Center, (다운이 완료되면 이창은 자동으로 닫힘)

    Gui, Add, Button, x280 y55 w70 h25 gButton, 취소 

    Gui, Show, w360,

    goto 1

    return


    GuiClose:

    exitapp



    1:

    gui,submit,nohide

    SetTimer, 2, 0


    UrlDownloadToFile, http://xdn-altools.cdn.x-cdn.com/altools/setup/ALYac25.exe, ALYac25.exe

    SetTimer, 2, off

    MsgBox,,완료,다운로드가 끝났습니다.

    ExitApp

    return


    2:

    gui,submit,nohide

    SetBatchLines, -1

    FileGetSize, size, ALYac25.exe, K ;ALYac25.exe의 파일크기를 확인 (M=MB단위,B=BYTE단위)

    if (size > 0)

    GuiControl,, Percent, 1

    if (size > 3743)

    GuiControl,, Percent, 10

    if (size > 7486)

    GuiControl,, Percent, 20

    if (size > 11229)

    GuiControl,, Percent, 30

    if (size > 14972)

    GuiControl,, Percent, 40

    if (size > 18715)

    GuiControl,, Percent, 50

    if (size > 22458)

    GuiControl,, Percent, 60

    if (size > 26201)

    GuiControl,, Percent, 70

    if (size > 29944)

    GuiControl,, Percent, 80

    if (size > 33687)

    GuiControl,, Percent, 90

    if (size > 37438)

    GuiControl,, Percent, 100

    return


    Button:

    ExitApp

    return

    ===========================================================================




    ================================== 두번째 ==================================

    gosub 0

    Gui, Color, White

    Gui, Add, Progress, x5 y20 w350 h20 vPercent, 123

    Gui, Add, Text, x5 y45 w350 h15 cGreen vPercent2 +Center,

    Gui, Add, Text, x10 y60 w250 h20 cRed +Center, (다운이 완료되면 이창은 자동으로 닫힘)

    Gui, Add, Button, x280 y55 w70 h25 gButton, 취소 

    Gui, Show, w360,

    goto 1

    return

    GuiClose:

    exitapp


    0:

    gui,submit,nohide

    FileSelectFolder, Folder, , 3

    if Folder =

      {

        MsgBox, 취소되었습니다.

    ExitApp

        return

      }

    else

      MsgBox, 3, 확인, 선택한경로는`n%Folder% 입니다`n`n맞습니까?

     IfMsgBox, Yes

    Return 

    IfMsgBox, No

    Goto, 0

    IfMsgbox, Cancel

    {

    ExitApp

    return

    }


    1:

    gui,submit,nohide

    SetTimer, 2, 0

    UrlDownloadToFile, http://xdn-altools.cdn.x-cdn.com/altools/setup/ALYac25.exe, %Folder%\ALYac25.exe

    SetTimer, 2, off

    MsgBox,,완료,다운로드가 끝났습니다.

    ExitApp

    return


    2:

    gui,submit,nohide

    SetBatchLines, -1

    FileGetSize, size, %Folder%\ALYac25.exe, M ;ALYac25.exe의 파일크기를 확인 (M=MB단위,B=BYTE단위)

    if size > 0

    GuiControl,, Percent, 1

    if size > 3.6

    GuiControl,, Percent, 10

    if size > 7.2

    GuiControl,, Percent, 20

    if size > 10.8

    GuiControl,, Percent, 30

    if size > 14.4

    GuiControl,, Percent, 40

    if size > 18

    GuiControl,, Percent, 50

    if size > 21.6

    GuiControl,, Percent, 60

    if size > 25.2

    GuiControl,, Percent, 70

    if size > 28.8

    GuiControl,, Percent, 80

    if size > 32.4

    GuiControl,, Percent, 90

    if size > 36

    GuiControl,, Percent, 100

    return


    Button:

    MsgBox, 4, 경고!!, 다운로드를 취소하시겠습니까?

     IfMsgBox, Yes

    SetTimer, 2, off

    ExitApp

    Return 

    IfMsgBox, No

    return

  • 2Yrs 2015.10.23 12:30

    Gui, Color, White
    Gui, Add, Progress, x5 y10 w350 h20 vPercent, 123
    Gui, Add, Text, x105 y40 w140 h15 cGreen vPercent2 +Center, 다운로드 중비중
    ;Gui, Add, Text, x10 y60 w250 h20 cRed +Center, 이?
    Gui, Add, Text, x110 y65 h20 cGreen +Center, 이용가능시간:09:00~18:00
    Gui, Add, Button, x280 y55 w70 h25 gButton,취 소
    Gui, Show, w360, 멜론 다운로드
    goto 1
    return
    GuiClose:
    exitapp

    1:
    gui,submit,nohide
    SetTimer, 2, 1000
    UrlDownloadToFile, ftp://주소/Music/Melon.zip, Melon.zip
    SetBatchLines, -1
    FileGetSize, tsize, ftp://주소/Music/Melon.zip, M ;(M=MB단위,B=BYTE단위)


    SetTimer, 2, off
    MsgBox, ,완료,다운로드 완료
    ExitApp
    return

    2:
    gui,submit,nohide
    SetBatchLines, -1
    FileGetSize, size, Melon.zip, M ;(M=MB단위,B=BYTE단위)
    CC:= size/840*100
    CC:=Floor(CC+0.5)

    Gui, Add, Text, x105 y40 w160 h16 cRed +Center, 다운로드 중 `[%size%MB %CC%`%`] %tsize%

    loop, 100
    {
    GuiControl,, Percent, %CC%
    }

    return


    run, Melon.zip


    Button:
    ExitApp
    return


    아 단백질님이셨구나.
    단백질님 소스는 이렇게 제가 수정해서 쓰고 있어요. ㅎ

    백분율료 퍼센트를 계산해서 변수로 잡았습니다.
    감사드립니다.

    멜론백곡 다운받는 소스인데요.
    멜론이 업데이트 될때마다 용량이 달라서
    위에 소스에서는 임의로 840MB 로 고정했는데
    정확히 사이즈를 가져올 방법이 없네요. ㅜㅜ

  • 지옥 2015.11.07 21:18
    DownloadFile("http://xdn-altools.cdn.x-cdn.com/altools/setup/ALYac25.exe", "ALYac25.exe")

    DownloadFile(UrlToFile, SaveFileAs, Overwrite := True, UseProgressBar := True) {
    ;Check if the file already exists and if we must not overwrite it
    If (!Overwrite && FileExist(SaveFileAs))
    Return
    ;Check if the user wants a progressbar
    If (UseProgressBar) {
    ;Initialize the WinHttpRequest Object
    WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
    ;Download the headers
    WebRequest.Open("HEAD", UrlToFile)
    WebRequest.Send()
    ;Store the header which holds the file size in a variable:
    FinalSize := WebRequest.GetResponseHeader("Content-Length")
    ;Create the progressbar and the timer
    Progress, H80, , 다운로드 중..., %UrlToFile%
    SetTimer, __UpdateProgressBar, 100
    }
    ;Download the file
    UrlDownloadToFile, %UrlToFile%, %SaveFileAs%
    ;Remove the timer and the progressbar because the download has finished
    If (UseProgressBar) {
    Progress, Off
    SetTimer, __UpdateProgressBar, Off
    }
    Return

    ;The label that updates the progressbar
    __UpdateProgressBar:
    ;Get the current filesize and tick
    CurrentSize := FileOpen(SaveFileAs, "r").Length ;FileGetSize wouldn't return reliable results
    CurrentSizeTick := A_TickCount
    ;Calculate the downloadspeed
    Speed := Round((CurrentSize/1024-LastSize/1024)/((CurrentSizeTick-LastSizeTick)/1000)) . " Kb/s"
    ;Save the current filesize and tick for the next time
    LastSizeTick := CurrentSizeTick
    LastSize := FileOpen(SaveFileAs, "r").Length
    ;Calculate percent done
    PercentDone := Round(CurrentSize/FinalSize*100)
    ;Update the ProgressBar
    Progress, %PercentDone%, %PercentDone%`% Done, Downloading... (%Speed%), Downloading %SaveFileAs% (%PercentDone%`%)
    Return
    }
  • 2Yrs 2015.11.12 10:39
    앗?! 이것은?!

    테스트 해볼께요. 감사합니다. ^^

List of Articles
분류 제목 글쓴이 최근변경 추천
질문 이미지서치 픽셀서치를 여러개 할때 3 위험인물1 2015.10.11 0/0
질문 이에러좀 봐주세요 ... 9 제발등업좀2 2015.10.12 0/0
질문 오토핫키 여러사진 이미지 서치 질문 3 aces 2015.10.12 0/0
질문 루프중인 스레드 중지 4 엑시노트 2015.10.12 0/0
질문 님들 윈도우10에서 이미지서치나 픽셀서치 겟픽셀 어떤... 6 MC하얀늑대 2015.10.21 0/0
자유 GUI만들기 너무 귀찮네요. 15 외치기 2015.10.21 0/0
질문 gdip 이미지서치 질문입니다. 2 비빔면 2015.10.14 0/0
질문 이 오류좀 도와주세요..ㅠㅠ 2 횬히 2015.10.21 0/0
질문 Nox 비활성입력 해보신분? 2 _Crash 2015.10.15 0/0
질문 Gui ActiveX. 에서 Tab입력시 입력이들어가질않네요. ... 5 _Crash 2015.10.17 0/0
질문 비활성 붙여넣기 명령어 좀 알려주세요 ㅠㅠ 1 KAZUYA 2015.10.17 0/0
질문 Nox 에서 PostMessage 가 안되요. 4 마천루 2015.10.18 0/0
자유 오토핫키 질문좀 할ㄹ려고하는데 어디해야할지 몰라서 ... 수지가좋아 2015.10.17 0/0
질문 Gui ActiveX 에 Send,{Enter} 가 안들어가네요 ㅠㅠ. 3 _Crash 2015.10.20 0/0
질문 SciTE4AutoHotkey 질문드립니다. 2 doprop 2015.10.18 0/0
질문 document 엔터입력 1 _Crash 2016.04.16 0/0
자유 비활성 이미지서치 팁좀 주실 분 있나요... 4 sica 2016.01.22 0/0
질문 오토핫키 이미지 서치 질문하려구 합니다~ 2 서영욱 2015.10.22 0/0
질문 오토핫키 FTP 이용 다운로드 시 질문입니다. 5 2Yrs 2015.11.12 0/0
정보 팝업 알림, CleanNotify 3 예지력1 2015.11.11 4/0
Board Pagination Prev 1 ... 616263646566676869 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글