매크로

조회 수 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
분류 제목 글쓴이 최근변경 추천
질문 [질문] Gui Creator, SaveFile(.xml) Load 실패 1 마토깽 2015.10.29 0/0
질문 오토핫키도 대부분 게임에서 막나요? 3 호태 2015.10.29 0/0
자유 오늘 생각없이 매크로돌리면서 은행사이트 들어갔더니 3 sica 2015.11.12 0/0
정보 ㅋㅋㅋㅋ 베스트글 보려고 2랩찍으려다가 2랩 찍기전에... 6 sica 2018.03.03 0/0
자유 으아아아아아아 오토핫키 베스트글 보고싶어요!! 3 sica 2015.11.03 0/0
질문 칼리브 설정하려고 하면 먹통 창공의창해 2015.10.26 0/0
질문 [해결] 실행시 Gui글자를 읽어들이지 못합니다. 5 마토깽 2015.10.26 0/0
질문 함수 불러와서 쓸 때 함수 내의 특정부분만 예외처리 ... 14 아이나인 2015.10.26 0/0
질문 오토핫키 공부해볼까 하는데 얼마나 걸릴까요? 6 Poohya 2015.10.27 0/0
질문 오토핫키 초보입니다 2 이리오리오 2015.11.15 0/0
자유 오토핫키나 그외 매크로 정보공유 톡방 1 최원태 2015.10.26 0/0
질문 controlclick 이용한 비활성 드래그 질문드려요 6 poerty 2015.10.30 0/0
질문 Dropdownlist 연동관련 질문드리겠습니다 22 최원태 2015.10.25 0/0
정보 팝업 알림, CleanNotify 3 예지력1 2015.11.11 4/0
질문 오토핫키 FTP 이용 다운로드 시 질문입니다. 5 2Yrs 2015.11.12 0/0
질문 오토핫키 이미지 서치 질문하려구 합니다~ 2 서영욱 2015.10.22 0/0
자유 비활성 이미지서치 팁좀 주실 분 있나요... 4 sica 2016.01.22 0/0
질문 document 엔터입력 1 _Crash 2016.04.16 0/0
질문 SciTE4AutoHotkey 질문드립니다. 2 doprop 2015.10.18 0/0
질문 Gui ActiveX 에 Send,{Enter} 가 안들어가네요 ㅠㅠ. 3 _Crash 2015.10.20 0/0
Board Pagination Prev 1 ... 140141142143144145146147148 ... 209 Next
/ 209

전체 최신 인기글

전체 주간 인기글