ฟอรั่ม PSsix

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ฟอรั่มของบล็อก http://pssix.blogspot.com


+2
Monaliza
sak20102005
6 posters

    INI for File download

    sak20102005
    sak20102005
    ระงับสมาชิก
    ระงับสมาชิก


    INI for File download Empty
    จำนวนข้อความ : 96
    ความนิยม : 4
    เข้าร่วมเมื่อ : 07/04/2011

    INI for File download Empty INI for File download

    ตั้งหัวข้อ by sak20102005 06/05/11, 04:55 am

    ดาวน์โหลดไฟล์ จากการอ่านไฟล์ .ini ลองนำไปดัดแปลงให้สามารถดาวน์โหลดได้หลายๆไฟล์กันดูนะครับ

    Code:

    #NoTrayIcon
    Local $fileinipath = @DesktopDir&'\Download.ini'
    Local $section = 'Section'
    Local $keypath = @DesktopDir
    Local $valuefile = 'update.dat'
    Local $url = 'http://www.autoitscript.com/autoit3/files/beta/update.dat'
    Local $destin = @DesktopDir & '\update.dat'
    If @IPAddress1 = '127.0.0.1' Then
       MsgBox(0, "", "กรุณาต่ออินเทอร์เน็ตและรันใหม่อีกครั้ง.")
       Exit
    EndIf
    If Not FileExists($fileinipath) Then IniWrite($fileinipath, $section, $keypath, $valuefile)
    If IniRead($fileinipath, $section, $keypath, Default) = $valuefile Then
       Local $sData = InetRead($url)
       Local $nBytesRead = @extended
       Local $btn = MsgBox(36, "Info file to download", "Filename: " & _
       $valuefile & @CRLF & "Bytes read: " & $nBytesRead & _
       @CRLF & @CRLF & BinaryToString($sData) & @CRLF&@CRLF&@TAB&@TAB&'        '& "ท่านต้องการดาวน์โหลดใช่หรือไม่?")
        If $btn = 7 Then Exit
       If Not FileExists($destin) Then
           Local $hDownload = InetGet($url, $destin, 1, 1)
          Local $i = 0
          Do
             $i += 1
             ToolTip("Downloading..Please wait!" & $i & ".sec", 400, 300, "")
             Sleep(1000)
          Until InetGetInfo($hDownload, 2)
          Local $nBytes = InetGetInfo($hDownload, 0)
          InetClose($hDownload)
          ToolTip("Download complete."& @CRLF &"File size: " & $nBytes & ".byte"& _
          @CRLF &"Use time download:" & $i & ".sec" , 400, 300, "")
          Sleep(3000)
          ToolTip("")
          Exit
       Else
          MsgBox(4096, "", "มีไฟล์ " & $valuefile & " อยู่ในเครื่องแล้ว ไม่จำเป็นต้องดาวน์โหลดอีก.")
          Exit
       EndIf
    EndIf

    คำคม: สอนวิธีหาปลา ดีกว่า หาปลามาแจก
    Monaliza
    Monaliza
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Program Coder
    จำนวนข้อความ : 213
    ความนิยม : 7
    เข้าร่วมเมื่อ : 03/10/2010

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by Monaliza 06/05/11, 09:46 am

    InetGet($url, $destin, 1, 1)
    พามารามิเตอร์ตรง ( ,1 ,1)นี้หมายถึงไรครับอ่านใน help แล้วไม่ค่อยเข้าใจไม่เก่งภาษาปะกิด
    options 0 = ?
    1 = ?
    2 = ?
    4 = ?
    8 = ?
    blackground 0 = ?
    1 = ?
    คือผมอยากทำโปรแกรม download fileจาก youtube
    ที่คิดไว้คราว ๆยังไม่ได้ลองเขียนนะครับ
    $file1 = InputBox ("Test", "กรุณาใส่ LINK ที่ต้องการ","","!",150,80)
    $file2 = @DesktopDir & '\update.dat'
    if $file1 <> "" Then
    If @error = 0 Then
    InetGet($file1,$file2, 1 ,1)
    EndIf


    sak20102005
    sak20102005
    ระงับสมาชิก
    ระงับสมาชิก


    INI for File download Empty
    จำนวนข้อความ : 96
    ความนิยม : 4
    เข้าร่วมเมื่อ : 07/04/2011

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by sak20102005 06/05/11, 10:09 am

    อันนี้ใช้ดาวน์โหลดไฟล์แบบต่อเนื่องได้ เป็นที่ต้องการของเพื่อนสมาชิก เลยจัดทำให้โดยเฉพาะ
    ใครอยากให้เขียนตัวอย่างโปรแกรมที่จะนำไปพัฒนาอะไร?ต่อก็บอก ยกเว้นบอทยากๆ

    Code:

    If @IPAddress1 = '127.0.0.1' Then
       MsgBox(0, "", "กรุณาต่ออินเทอร์เน็ตและรันใหม่อีกครั้ง.")
        Exit
    EndIf
    Global $var, $hDownload
    Local $inifilepath = @DesktopDir&'\download.ini'
    Local $section = 'Section'
    Global $array[3]
    $array[0] = 'computer012.gif'
    $array[1] = 'heart.gif'
    $array[2] = 'sexy_50.gif'
    Local $i
    For $i = 0 To UBound($array -1) -1
      IniWrite($inifilepath, $section, "Key" & $i, $array[$i])
    Next
    ToolTip("กำลังดาวน์โหลด..โปรดรอสักครู่!", 400, 300, "")
    For $i = 0 To UBound($array -1) -1
       $var = IniRead($inifilepath, $section, "Key" & $i, Default)
        If $var = 'computer012.gif' Then
            If InetRead("http://www.freesmileys.org/smileys/smiley-computer012.gif")Then
              $hDownload = InetGet("http://www.freesmileys.org/smileys/smiley-computer012.gif", @DesktopDir&'\computer012.gif', 1, 1)
           EndIf
        EndIf
       If $var = 'heart.gif' Then
            If InetRead("http://i54.photobucket.com/albums/g107/onlinegemini/heart.gif")Then
                $hDownload = InetGet("http://i54.photobucket.com/albums/g107/onlinegemini/heart.gif", @DesktopDir&'\heart.gif', 1, 1)
           EndIf
        EndIf
       If $var = 'sexy_50.gif' Then
            If InetRead("http://i241.photobucket.com/albums/ff141/trancexx_bucket/sexy_50.gif")Then
                $hDownload = InetGet("http://i54.photobucket.com/albums/g107/onlinegemini/heart.gif", @DesktopDir&'\sexy_50.gif', 1, 1)
           EndIf
        EndIf
    Next
    InetClose($hDownload)
    ToolTip("")
    MsgBox(4096, "", "Download complete.")
    Exit


    แก้ไขล่าสุดโดย sak20102005 เมื่อ 06/05/11, 10:55 am, ทั้งหมด 1 ครั้ง
    sak20102005
    sak20102005
    ระงับสมาชิก
    ระงับสมาชิก


    INI for File download Empty
    จำนวนข้อความ : 96
    ความนิยม : 4
    เข้าร่วมเมื่อ : 07/04/2011

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by sak20102005 06/05/11, 10:38 am

    Monaliza พิมพ์ว่า:InetGet($url, $destin, 1, 1)
    พามารามิเตอร์ตรง ( ,1 ,1)นี้หมายถึงไรครับอ่านใน help แล้วไม่ค่อยเข้าใจไม่เก่งภาษาปะกิด
    options 0 = ?
    1 = ?
    2 = ?
    4 = ?
    8 = ?
    blackground 0 = ?
    1 = ?
    คือผมอยากทำโปรแกรม download fileจาก youtube
    ที่คิดไว้คราว ๆยังไม่ได้ลองเขียนนะครับ
    $file1 = InputBox ("Test", "กรุณาใส่ LINK ที่ต้องการ","","!",150,80)
    $file2 = @DesktopDir & '\update.dat'
    if $file1 <> "" Then
    If @error = 0 Then
    InetGet($file1,$file2, 1 ,1)
    EndIf

    [จากซ้ายไปขวา]
    พารามิเตอร์ 1 ตัวแรกคือ options หมายถึง บังคับให้ติดต่อกับเว็บไซด์ให้สำเร็จ (Reload)
    พารามิเตอร์ 1 ตัวที่สองคือ background หมายถึง ถ้าต้องการรีเทิร์นค่า ใช้ 1 และแบบปกติใช้ 0
    ค่าที่รีเทิร์นจะนำไปใช้กับอีกคำสั่งนึง ท่านลองตรวจสอบดูในโค๊ดก็รู้ว่า..นำไปใช้ทำอะไร?
    Arm
    Arm
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Master PSsix Program Coder
    จำนวนข้อความ : 268
    ความนิยม : 54
    เข้าร่วมเมื่อ : 31/03/2011
    อายุ : 26

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by Arm 06/05/11, 04:57 pm

    คุณ Monaliza ถ้าทำโปรแกรมโหลดหนังจาก youtube เสร็จเมื่อไหร่
    อยากลืมเอามาแบ่งปันกันนะคร้าบบบ ^^ em218
    aut
    aut
    PSsix Powerful Scripting Class
    PSsix Powerful Scripting Class


    PSsix Game Coder
    จำนวนข้อความ : 472
    ความนิยม : 126
    เข้าร่วมเมื่อ : 24/07/2010

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by aut 06/05/11, 07:16 pm

    ความกากล่าสุด เหอๆ อทิบายก็ผิดอีกแย้ว สงสัยมานใช้โปรแกรมช่วยแปลมาแน่

    พารามิเตอร์ 1 ตัวที่สองคือ background หมายถึง ถ้าต้องการรีเทิร์นค่า ใช้ 1 และแบบปกติใช้ 0
    ค่าที่รีเทิร์นจะนำไปใช้กับอีกคำสั่งนึง ท่านลองตรวจสอบดูในโค๊ดก็รู้ว่า..นำไปใช้ทำอะไร?


    ความหมายมาน
    0 = (default) Wait until the download is complete before continuing.
    0 รอห้ายดาวโหลดไฟล์เส็ดก่อนแล้วทำงานสคิปต่อ
    1 = return immediately and download in the background (see remarks).
    1 ดาวน์โหลดแล้วทำงานสคิปต่อไปเลย ไม่ต้องรอดาวโหลดเส็ด

    กากไม่กากดูตงนี้อ่านะ อทิบายมัวซัววะ เหอๆ หยุดใช้โปรแกรมช่วยแปลมาอทิบายเสียทีนะนายกาก

    sak20102005 พิมพ์ว่า:
    Monaliza พิมพ์ว่า:InetGet($url, $destin, 1, 1)
    พามารามิเตอร์ตรง ( ,1 ,1)นี้หมายถึงไรครับอ่านใน help แล้วไม่ค่อยเข้าใจไม่เก่งภาษาปะกิด
    options 0 = ?
    1 = ?
    2 = ?
    4 = ?
    8 = ?
    blackground 0 = ?
    1 = ?
    คือผมอยากทำโปรแกรม download fileจาก youtube
    ที่คิดไว้คราว ๆยังไม่ได้ลองเขียนนะครับ
    $file1 = InputBox ("Test", "กรุณาใส่ LINK ที่ต้องการ","","!",150,80)
    $file2 = @DesktopDir & '\update.dat'
    if $file1 <> "" Then
    If @error = 0 Then
    InetGet($file1,$file2, 1 ,1)
    EndIf

    [จากซ้ายไปขวา]
    พารามิเตอร์ 1 ตัวแรกคือ options หมายถึง บังคับให้ติดต่อกับเว็บไซด์ให้สำเร็จ (Reload)
    พารามิเตอร์ 1 ตัวที่สองคือ background หมายถึง ถ้าต้องการรีเทิร์นค่า ใช้ 1 และแบบปกติใช้ 0
    ค่าที่รีเทิร์นจะนำไปใช้กับอีกคำสั่งนึง ท่านลองตรวจสอบดูในโค๊ดก็รู้ว่า..นำไปใช้ทำอะไร?
    sak20102005
    sak20102005
    ระงับสมาชิก
    ระงับสมาชิก


    INI for File download Empty
    จำนวนข้อความ : 96
    ความนิยม : 4
    เข้าร่วมเมื่อ : 07/04/2011

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by sak20102005 07/05/11, 12:29 am

    ไม่อยากเถียงกับคนพาลว่ะ เพลาๆอาการคลุ้มคลั่งลงบ้างก็ได้ ใครจะเชื่อใคร ก็เป็นสิทธิ์ของเขา

    ของนายถูกต้องก็ถูกต้องไป ไม่เห็นมีอะไรเกิดขึ้น ของเราก็ถูกต้องเเหมือนกัน

    แต่ถ้านายเห็นว่าไมุ่ถูกต้อง ก็เป็นเรื่องของนาย จะมายั่วให้เกิดโทสะเรอะ ไม่มีทาง

    ------------------------------------------------------------------------------------------------
    ไอ้เจ้า aut นี่นะ พอแถเข้ามาหาเรื่องกับเราที่ไร มันคาใจว่า ทำไม? ถึงเขียนคำสั่ง Array แบบมันไม่ได้

    ก็เพราะความรู้เรายังไม่ถึงไง ไม่ค่อยได้หัดเขียนด้วย พฤติกรรม ณ. ปัจจุบันของมัน คล้ายๆกับว่า

    มันกำลังพยายามให้เราเขียนตำสั่ง Array ให้ได้แบบมัน มันถึงตอกย้ำเรื่อง Array กับเราอยู่เรื่อยๆ

    ถ้าขาด Array ..สงสัยไอ้เจ้า aut คงทำอะไรไม่เป็นเลยมั๊ง.
    Monaliza
    Monaliza
    PSsix Member Super Class III
    PSsix Member Super Class III


    PSsix Program Coder
    จำนวนข้อความ : 213
    ความนิยม : 7
    เข้าร่วมเมื่อ : 03/10/2010

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by Monaliza 09/05/11, 05:47 am

    ลิ้ง("https://www.youtube.com/watch?v=-3QKEPpXVhE")
    ถ้าต้องการdownload linkตามข้างบนนี้เราจะกำหนดค่าตัวแปร $file2 ยังไงดีครับขอคำแนะนำด้วยครับ
    ......................................................
    $link1 = InputBox ("Test", "กรุณาใส่ link ที่ต้องการ","","",150,80)
    $file2 = @DesktopDir&\"xxxxxx" ตรงนี้เราจะระบุชื่อไฟล์ยังไงดีครับ
    If link1 <> "" Then
    If NOT @error Then
    InetGet($link1,$file2, 0 ,1)
    Else
    Msgbox(0,"test","link Error")
    EndIf
    Else
    Msgbox(0,"test","กรูณาใส่link")
    EndIf
    -3QKEPpXVhEตัวนี้คือIDที่ต้องการdownload

    anirud
    anirud
    มือใหม่เพิ่งสมัคร
    มือใหม่เพิ่งสมัคร


    INI for File download Empty
    จำนวนข้อความ : 6
    ความนิยม : 0
    เข้าร่วมเมื่อ : 26/11/2010
    อายุ : 32
    ที่อยู่ : SakonNakhon...Thailand

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by anirud 09/05/11, 02:41 pm

    น่าสนใจมากครับ...
    เดี๋ยวจะเอาไปประยุกต์
    ขอบคุณมากครับผม

    "ใครจะว่าอย่างไรอย่าไปสนใจครับผม...คนที่มีความรู้เก่งๆนั้นมีมาก...แต่คนที่มีความรู้เก่งๆแล้วนำมาเผยแพร่นั้นมีน้อย..."

    "สู้ และนำเสนอ บทความดีๆต่อไปครับ ท่าน sak20102005"


    อัต
    อัต
    PSsix Member Class III
    PSsix Member Class III


    INI for File download Empty
    จำนวนข้อความ : 54
    ความนิยม : 9
    เข้าร่วมเมื่อ : 07/05/2011

    INI for File download Empty Re: INI for File download

    ตั้งหัวข้อ by อัต 10/05/11, 12:28 pm

    มัว = เก่ง ?

    เฮ้อ... Pseudo Programer

    em232

      เวลาขณะนี้ 02/05/24, 12:40 pm