UrlDownloadToFile

ÆÄÀÏÀ» ÀÎÅͳݿ¡¼­ ³»·Á¹Þ½À´Ï´Ù.

UrlDownloadToFile, URL, Filename

¸Å°³º¯¼ö

URL

³»·Á ¹ÞÀ» ÆÄÀÏÀÇ URL. ¿¹¸¦ µé¾î, http://someorg.org´Â ±× ȸ»çÀÇ È¯¿µ ÆäÀÌÁö¸¦ ¿­¶÷ÇÕ´Ï´Ù.

Filename

ÆÄÀÏ¿¡ ³»·Á¹Þ±â: Áö¿ªÀûÀ¸·Î »ý¼ºµÉ ÆÄÀÏÀÇ À̸§À» ÁöÁ¤ÇÕ´Ï´Ù. Àý´ë °æ·Î°¡ ÁöÁ¤µÇÁö ¾ÊÀ¸¸é %A_WorkingDir%¿¡ ÀÖ´Ù°í °£Áֵ˴ϴÙ. ±âÁ¸ÀÇ ÆÄÀÏÀº ÀÌ »õ ÆÄÀÏ·Î µ¤¾î¾²±â µË´Ï´Ù.

º¯¼ö¿¡ ³»·Á¹Þ±â: ¾Æ·¡ÀÇ ¿¹Á¦¸¦ ÂüÁ¶ÇϽʽÿÀ.

ErrorLevel

[v1.1.04+] ÀÌ ¸í·É¾î´Â ½ÇÆнà ¿¹¿Ü¸¦ ´øÁú ¼ö ÀÖ½À´Ï´Ù. ´õ ÀÚ¼¼ÇÑ Á¤º¸´Â ½ÇÇà½Ã°£ ¿¡·¯¸¦ ÂüÁ¶ÇϽʽÿÀ.

ErrorLevelÀº ¹®Á¦°¡ ÀÖÀ¸¸é 1·Î ¼³Á¤µÇ°í ¼º°øÇϸé 0ÀÌ ¼³Á¤µË´Ï´Ù.

³íÆò

¿ø°Ý ÆÄÀÏÀÌ Á¸ÀçÇÏÁö ¾Ê´õ¶óµµ ³»·Á¹Þ±â´Â ¸¶Ä¡ ¼º°øÇÑ °Íó·³ º¸ÀÏ ¼ö ÀÖ½À´Ï´Ù. ¸¹Àº À¥ ¼­¹ö°¡ ½ÇÆÐÇÑ ÆÄÀÏ ´ë½Å¿¡ ¿¡·¯ ÆäÀÌÁö¸¦ º¸³»±â ¶§¹®ÀÔ´Ï´Ù. ÀÌ ¿¡·¯ ÆäÀÌÁö°¡ Filename ´ë½Å¿¡ ÀúÀåµÉ °ÍÀÔ´Ï´Ù.

Internet Explorer 3 ÀÌ»óÀº ¼³Ä¡ÇØ¾ß ÀÌ ±â´ÉÀÌ ÀÛµ¿ÇÕ´Ï´Ù. ¹æÈ­º®À̳ª ¿©·¯ ³×Æ®¿öÅ© ¾î´ðÅÍ ¶§¹®¿¡ ÀÌ ±â´ÉÀÌ ÀÛµ¿ÇÏÁö ¾ÊÀ» ¼ö ÀÖ½À´Ï´Ù. ¶Ç, ¾î¶² À¥ »çÀÌÆ®´Â ÀÌ·± ½ÄÀÇ ³»·Á¹Þ±â¸¦ ±ÝÁöÇϱ⵵ ÇÕ´Ï´Ù.

Caching:

Proxies: ¸¶ÀÌÅ©·Î¼ÒÇÁÆ® ÀÎÅÍ³Ý ÀͽºÇ÷η¯ÀÇ ¼³Á¤¿¡ ÇÁ·Ï½Ã¸¦ »ç¿ëÇϵµ·Ï ±¸¼ºµÇ¾î ÀÖ´Ù¸é UrlDownloadToFileÀº ÇÁ·Ï½Ã ¼­¹ö¸¦ »ç¿ëÇÏ¿© ÀÎÅͳݿ¡ Á¢±ÙÇÕ´Ï´Ù.

FTP ±×¸®°í Gopher: v1.0.48.04+´Â FTP¿Í Gopher URLÀ» Áö¿øÇÕ´Ï´Ù. ¿¹¸¦ µé¾î:

UrlDownloadToFile, ftp://example.com/home/My File.zip, C:\My Folder\My File.zip  ; À͸íÀ¸·Î ·Î±×ÀÎ ÇÕ´Ï´Ù.
UrlDownloadToFile, ftp://user:pass@example.com:21/home/My File.zip, C:\My Folder\My File.zip  ; ƯÁ¤ »ç¿ëÀÚ·Î ·Î±×ÀÎ ÇÕ´Ï´Ù.
UrlDownloadToFile, ftp://user:pass@example.com/My Directory, C:\Dir Listing.html  ; µð·ºÅ丮 ¸®½ºÆ®¸¦ HTML Çü½ÄÀ¸·Î ¾ò½À´Ï´Ù.

°ü·Ã Ç׸ñ

FileRead, FileCopy

¿¹Á¦

UrlDownloadToFile, http://ahkscript.org/download/1.1/version.txt, C:\AutoHotkey Latest Version.txt
UrlDownloadToFile, http://someorg.org/archive.zip, C:\SomeOrg's Archive.zip
; ¿¹Á¦: ÅؽºÆ®¸¦ º¯¼ö¿¡ ³»·Á¹Þ½À´Ï´Ù:
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
whr.Open("GET", "http://ahkscript.org/download/1.1/version.txt", true)
whr.Send()
; À§ÀÇ 'true'¸¦ »ç¿ëÇÏ°í ¾Æ·¡ÀÇ È£ÃâÀ» »ç¿ëÇÏ¿© ½ºÅ©¸³Æ®¿¡ ¹ÝÀÀÇϵµ·Ï ¸¸µì´Ï´Ù.
whr.WaitForResponse()
version := whr.ResponseText
MsgBox % version
; ¿¹Á¦: ºñµ¿±â HTTP ¿äûÀ» ¸¸µì´Ï´Ù.

req := ComObjCreate("Msxml2.XMLHTTP")
; async¸¦ ÄÑ°í ¿äûÀ» ¿±´Ï´Ù.
req.open("GET", "http://ahkscript.org/download/1.1/version.txt", true)
; ¿ªÈ£Ãâ ÇÔ¼ö¸¦ ¼³Á¤ÇÕ´Ï´Ù (v1.1.17+).
req.onreadystatechange := Func("Ready")
; ¿äûÀ» Àü¼ÛÇÕ´Ï´Ù. ¿Ï·áµÇ¸é Ready()°¡ È£ÃâµË´Ï´Ù.
req.send()
/*
; ±â´Ù¸± »ý°¢À̶ó¸é onreadystatechange´Â ÇÊ¿ä°¡ ¾ø½À´Ï´Ù.
; async=true·Î ¼³Á¤ÇÏ°í ±â´Ù¸®¸é ³»·Á¹Þ±â°¡ µÇ´Â µ¿¾È¿¡µµ
; ½ºÅ©¸³Æ®°¡ ¿©ÀüÈ÷ ¹ÝÀÀÇÒ ¼ö ÀÖ½À´Ï´Ù.
; ¹Ý¸é¿¡ async=false·Î ¼³Á¤ÇÏ¸é ½ºÅ©¸³Æ®´Â ¹ÝÀÀÇÏÁö ¾Ê½À´Ï´Ù.
while req.readyState != 4
    sleep 100
*/
#Persistent

Ready() {
    global req
    if (req.readyState != 4)  ; Not done yet.
        return
    if (req.status == 200 || req.status == 304) ; OK.
        MsgBox % "Latest AutoHotkey version: " req.responseText
    else
        MsgBox 16,, % "Status " req.status
    ExitApp
}