1. Tải bản cài đặt AutoIT mới nhất

    Chào Khách. Nếu bạn mới tham gia và chưa cài đặt AutoIT.
    Vui lòng vào topic trên để tải bản AutoIT mới nhất nhé
    Dismiss Notice
  2. Quy định và nội quy

    Chào Khách. Vui lòng đọc kỹ nội quy và quy định của diễn đàn
    Để tránh bị ban một cách đáng tiếc nhé!
    Dismiss Notice
  3. Hướng dẫn chèn mã AutoIT trong diễn đàn

    Chào Khách. Vui lòng xem qua bài viết này
    Để biết cách chèn mã AutoIT trong diễn đàn bạn nhé :)
    Dismiss Notice

Hướng dẫn Tự động dò tìm, download bản mới nhất và cài đặt phần mềm Gom Player

Thảo luận trong 'Hướng dẫn - Bài tập căn bản' bắt đầu bởi Vĩ Kha AutoIT, 12/9/15.

  1. Vĩ Kha AutoIT

    Vĩ Kha AutoIT Trial Moderator Trial Moderator
    • 8/11

    Tham gia ngày:
    7/9/15
    Bài viết:
    39
    Đã được thích:
    97
    Mã (AutoIt):
    #include <PPCC.au3>

    _AU3RecordSetup()

    ;~ WinMinimizeAll()

    $msgb=MsgBoxDJS(4+32+256,'GOM Media Player Setup','Would you like to download newest version?' & @LF & 'Automatic choose No after',5)
    ;~ ConsoleWrite($msgb)
    ;~ Exit
    $SavedPath="D:\setup\multimedia tools\gom player"

    If $msgb=7 Or $msgb=-1 Then
    $Found=_GetFileName($SavedPath,".exe",'SETUP.EXE')
    Run($SavedPath & '\' & $Found)
    Sleep(3000)
    _WinWaitActivate("GOM Player Setup","Welcome to the GOM P")
    Send("{ALTDOWN}n{ALTUP}")
    _WinWaitActivate("GOM Player Setup ","Please review the li")
    Send("{ALTDOWN}a{ALTUP}")
    _WinWaitActivate("GOM Player Setup ","Choose which feature")
    Send("{ALTDOWN}n{ALTUP}")
    _WinWaitActivate("GOM Player Setup ","Choose Install Locat")
    Send("{CTRLDOWN}c{CTRLUP}{CTRLDOWN}{CTRLUP}{CTRLDOWN}{CTRLUP}{HOME}{SHIFTDOWN}{RIGHT}d{SHIFTUP}{HOME}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ALTDOWN}i{ALTUP}")
    _WinWaitActivate("GOM Player Setup ","Completing the GOM P")
    Send("{ALTDOWN}f{ALTUP}")
    _WinWaitActivate("GOM VIDEO CONVERTER","Download and install")
    ControlClick("GOM VIDEO CONVERTER","Download and install","[CLASS:Button; INSTANCE:2]")
    Exit
    Else
    $URL0='http://player.gomlab.com/eng/download/'
    $TempFile = "_Test.html"
    If FileExists(@TempDir & '\' & $TempFile) Then
    FileDelete(@TempDir & '\' & $TempFile)
    Sleep(2000)
    EndIf
    _DownloadFile($URL0, @TempDir, $TempFile);~ ShellExecute($URL)
    $file=FileOpen(@TempDir & '\' & $TempFile)
    If $file = -1 Then ; Check if file opened for reading OK
    MsgBox(0, "Error", "Unable to open file.", 5)
    Exit
    EndIf

    $BeginTag='<a href="/eng/download/'
    $EndTag='" onclick="javascript: pageTracker._trackPageview(' & "'/CNET')"
    $TempStr=_GetLinkDownload($file,$BeginTag,$EndTag) ;~ ConsoleWrite($TempStr & @CRLF)
    FileClose($file)
    $URL=$URL0 & $TempStr
    ConsoleWrite($URL & @CRLF)

    $TempFile = "_Test.html"
    If FileExists(@TempDir & '\' & $TempFile) Then
    FileDelete(@TempDir & '\' & $TempFile)
    Sleep(2000)
    EndIf
    _DownloadFile($URL, @TempDir, $TempFile);~ ShellExecute($URL)
    $file=FileOpen(@TempDir & '\' & $TempFile)
    If $file = -1 Then ; Check if file opened for reading OK
    MsgBox(0, "Error", "Unable to open file.", 5)
    Exit
    EndIf

    $BeginTag='<div class="dlLinkWrapper"> <a href="'
    $EndTag='"'
    $TempStr=_GetLinkDownload($file,$BeginTag,$EndTag) ;~ ConsoleWrite($TempStr & @CRLF)
    FileClose($file)
    $URL='' & $TempStr
    ConsoleWrite($URL & @CRLF)

    $TempFile = "_Test.html"
    If FileExists(@TempDir & '\' & $TempFile) Then
    FileDelete(@TempDir & '\' & $TempFile)
    Sleep(2000)
    EndIf
    _DownloadFile($URL, @TempDir, $TempFile);~ ShellExecute($URL)
    $file=FileOpen(@TempDir & '\' & $TempFile)
    If $file = -1 Then ; Check if file opened for reading OK
    MsgBox(0, "Error", "Unable to open file.")
    Exit
    EndIf
    $BeginTag='URL=http://software'
    $EndTag='.EXE"/>'
    $TempStr=_GetLinkDownload($file,$BeginTag,$EndTag) ;~ ConsoleWrite($TempStr & @CRLF)
    FileClose($file)
    $URL='http://software' & $TempStr & '.EXE'
    ConsoleWrite($URL & @CRLF)
    $URLSplit=StringSplit($URL,'=')
    $FileName=$URLSplit[UBound($URLSplit)-1] ;~
    ConsoleWrite($FileName & @CRLF)
    If Not FileExists($SavedPath & '\' & $FileName) Then _DownloadFile($URL,$SavedPath,$FileName)

    Run($SavedPath & '\' & $FileName)
    Sleep(3000)
    _WinWaitActivate("GOM Player Setup","Welcome to the GOM P")
    Send("{ALTDOWN}n{ALTUP}")
    _WinWaitActivate("GOM Player Setup ","Please review the li")
    Send("{ALTDOWN}a{ALTUP}")
    _WinWaitActivate("GOM Player Setup ","Choose which feature")
    Send("{ALTDOWN}n{ALTUP}")
    _WinWaitActivate("GOM Player Setup ","Choose Install Locat")
    Send("{CTRLDOWN}c{CTRLUP}{CTRLDOWN}{CTRLUP}{CTRLDOWN}{CTRLUP}{HOME}{SHIFTDOWN}{RIGHT}d{SHIFTUP}{HOME}{SHIFTDOWN}{END}{SHIFTUP}{CTRLDOWN}c{CTRLUP}{ALTDOWN}i{ALTUP}")
    _WinWaitActivate("GOM Player Setup ","Completing the GOM P")
    Send("{ALTDOWN}f{ALTUP}")
    _WinWaitActivate("GOM VIDEO CONVERTER","Download and install")
    ControlClick("GOM VIDEO CONVERTER","Download and install","[CLASS:Button; INSTANCE:2]")
    EndIf

    FileDelete(@DesktopCommonDir & '\GOM Player.lnk')
    Đây là một code mẫu, các bạn có thể copy vào file .au3 chạy thử. Sau đó phân tích hàm, thực chất cũng không có gì khó lắm.
    Đoạn code trên sử dụng include PPCC của 1 anh trên diễn đàn bkav.com. Các bạn có thể tham khảo tại: http://vietautoit.com/threads/thiet...-phim-autoplay-qua-cac-cong-cu-cua-contro.59/

    Nguồn: PPCC - forum.bkav.com
     
    Phan Dong thích bài này.

Chia sẻ trang này

Đang tải...