ฟอรั่ม 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 posters

    สอบถามเรื่องการสร้างไฟล์ติดตั้งโปรแกรมอัตโนมัติ ครับ

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


    สอบถามเรื่องการสร้างไฟล์ติดตั้งโปรแกรมอัตโนมัติ ครับ Empty
    จำนวนข้อความ : 1
    ความนิยม : 0
    เข้าร่วมเมื่อ : 29/05/2015

    สอบถามเรื่องการสร้างไฟล์ติดตั้งโปรแกรมอัตโนมัติ ครับ Empty สอบถามเรื่องการสร้างไฟล์ติดตั้งโปรแกรมอัตโนมัติ ครับ

    ตั้งหัวข้อ by pongmtong1 29/09/16, 12:02 pm

    คือผม อยากทำโปรแกรมติดตั้งอัตโนมัติเลยหาข้อมูลแล้วไปเจอกับ [You must be registered and logged in to see this link.] เว็ปนี้ เลยลองทำตามปรากฏว่า มันไม่กดปุ่ม ใดๆที่โปรแกรมตามที่เราเขียนไว้ครับ ผมใช้ Windows 10 ครับ
    แต่ว่าลองใช้กับหน้าต่าง Windows มันใช้ได้นะครับ พอมีวิธีแก้ไขไหมครับ ตัวอย่างโค็ด


    Run("kmp") ไม่ทำงาน ใช้เป็น ShellExecute แทนครับ
    WinWaitActive("Installer","")
    Send("{ENTER}")   ไม่ทำงาน
    WinWaitActive("","Welcome")
    Send("{ENTER}") ไม่ทำงาน
    WinWaitActive("","License Agreement")
    Send("{ENTER}") ไม่ทำงาน
    WinWaitActive("","Choose Components")
    send("{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}") ไม่ทำงาน
    WinWaitActive("","Install Location")
    Send("C:\KMPlayer")
    Send("{ENTER}")
    WinWaitActive("","Completing")
    Send("{SPACE}{ENTER}")

    รบกวนด้วยนะครับขอบคุณครับ
    sak
    sak
    PSsix Member Class II
    PSsix Member Class II


    สอบถามเรื่องการสร้างไฟล์ติดตั้งโปรแกรมอัตโนมัติ ครับ Empty
    จำนวนข้อความ : 34
    ความนิยม : 0
    เข้าร่วมเมื่อ : 26/11/2017

    สอบถามเรื่องการสร้างไฟล์ติดตั้งโปรแกรมอัตโนมัติ ครับ Empty Re: สอบถามเรื่องการสร้างไฟล์ติดตั้งโปรแกรมอัตโนมัติ ครับ

    ตั้งหัวข้อ by sak 06/12/17, 04:13 am

    pongmtong1 พิมพ์ว่า:คือผม อยากทำโปรแกรมติดตั้งอัตโนมัติเลยหาข้อมูลแล้วไปเจอกับ [You must be registered and logged in to see this link.] เว็ปนี้ เลยลองทำตามปรากฏว่า มันไม่กดปุ่ม ใดๆที่โปรแกรมตามที่เราเขียนไว้ครับ ผมใช้ Windows 10 ครับ
    แต่ว่าลองใช้กับหน้าต่าง Windows มันใช้ได้นะครับ พอมีวิธีแก้ไขไหมครับ ตัวอย่างโค็ด


    Run("kmp") ไม่ทำงาน ใช้เป็น ShellExecute แทนครับ
    WinWaitActive("Installer","")
    Send("{ENTER}")   ไม่ทำงาน
    WinWaitActive("","Welcome")
    Send("{ENTER}") ไม่ทำงาน
    WinWaitActive("","License Agreement")
    Send("{ENTER}") ไม่ทำงาน
    WinWaitActive("","Choose Components")
    send("{TAB}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{SPACE}{ENTER}") ไม่ทำงาน
    WinWaitActive("","Install Location")
    Send("C:\KMPlayer")
    Send("{ENTER}")
    WinWaitActive("","Completing")
    Send("{SPACE}{ENTER}")

    รบกวนด้วยนะครับขอบคุณครับ

    ต้องใส่คำสั่ง Sleep(DelayNumber) เพื่อหน่วงเวลา การทำงาน ของ สคิ๊ปคำสั่งให้เหมาะสม
    ลองไล่ใส่ไปที่ละบันทัดคำสั่ง แล้วลองทดสอบดูนะครับ
    เมื่อก่อน ตอนที่ผมเพิ่งเริ่มหัดเขียน ก็ประสบปัญหานี้เหมือนกัน

    ท่านสามารถติดตั้งโปรแกรมต่างๆ ให้เป็นไปแบบอัตโนมัติได้ โดยใช้ Silent Mode
    ซึ่งง่ายกว่าการส่งคีย์ มีโปรแกรมที่มีชื่อว่า CMenu สามารถหาค่า parameters ที่ใช้ในโปรแกรมนั้นๆได้

    Example:
    Code:

    Local $pid = Run("kmplayer-4-1-2-2.exe /S")
    Sleep(100)
    If WinWaitActive("Installer La", "Please se") Then Send("{Enter}")
    Do
        ToolTip("Installing.. PleaseWait!")
        if Not ProcessExists($pid) Then ExitLoop
        Sleep(100)
    Until $pid = 0
    ToolTip("")
    MsgBox(0, "", "Installation Successes.")
    Exit

    OR

    Code:

    #NoTrayIcon
    Local $pid = Run("kmplayer-4-1-2-2.exe /S", @ScriptDir, @SW_HIDE)
    If $pid = @error Then
        MsgBox(0, "", "Error! can not setup", 3)
     Exit
    EndIf
    Sleep(100)
    If WinWaitActive("Installer La", "Please se") Then Send("{Enter}")
    Sleep(7000)
    Do
        if ProcessExists($pid) Then
        ToolTip("Installing.. PleaseWait!")
     Else
     ProcessClose($pid)
     ExitLoop
     EndIf
        Sleep(100)
    Until $pid = 0
    ToolTip("")
    MsgBox(64, "", "Installation Successes.", 5)

    OR

    ใช้ ProgressBar แสดงความคืบหน้า ในการติดตั้งโปรแกรม

    Code:

    #NoTrayIcon
    #include <AutoItConstants.au3>
    #include <MsgBoxConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>

    Local $path = "C:\KMPlayer\KMPlayer.exe"
    If FileExists($path) Then
        MsgBox(0, "", "Cannot setup. Must uninstall old program now to before new program setup.")
     Exit
    EndIf

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Installing...", 200, 34, -1, -1)
    $Progress1 = GUICtrlCreateProgress(8, 8, 185, 17)
    GUISetState(@SW_HIDE)
    #EndRegion ### END Koda GUI section ###

    Local $pid = Run("kmplayer-4-1-2-2.exe /S", @ScriptDir, @SW_HIDE)
    If $pid = @error Then
        MsgBox(0, "", "Error! can not setup", 3)
     Exit
    EndIf
    Sleep(100)
    If WinWaitActive("Installer La", "Please se") Then Send("{Enter}")
    Sleep(7000)

    GUISetState(@SW_SHOW)

    While 1
     $nMsg = GUIGetMsg()
     Switch $nMsg
     Case $GUI_EVENT_CLOSE
     ProcessClose($pid)
     Exit
     EndSwitch

     if Not ProcessExists($pid) Then
        ProcessClose($pid)
     ExitLoop
     EndIf
        Progression()
    WEnd

    Func Progression()
        Local $aSize = DirGetSize("C:\KMPlayer", $DIR_EXTENDED)
        If Not @error Then
           Local $dat = ($aSize[1] + $aSize[2])/100
       If $dat > 0 Then GUICtrlSetData($Progress1, $dat*100)
       If GUICtrlRead($Progress1) = 100 Then
       Sleep(1000)
       GUIDelete($Form1)
       Sleep(1000)
       MsgBox(64, "", "Installation Successes.", 5)
       Exit
     EndIf
       Sleep(10)
     EndIf
    EndFunc

    หรือใช้ Progress On

    Code:

    #NoTrayIcon
    #include <AutoItConstants.au3>
    #include <MsgBoxConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <ProgressConstants.au3>
    #include <WindowsConstants.au3>

    Local $path = "C:\KMPlayer\KMPlayer.exe"
    If FileExists($path) Then
        MsgBox(0, "", "Cannot setup. Must uninstall old program now to before new program setup.")
     Exit
    EndIf
    Local $pid = Run("kmplayer-4-1-2-2.exe /S", @ScriptDir, @SW_HIDE)
    If $pid = @error Then
        MsgBox(0, "", "Error! can not setup", 3)
     Exit
    EndIf
    Sleep(100)
    If WinWaitActive("Installer La", "Please se") Then Send("{Enter}")
    Sleep(7000)
    ProgressOn("KMPlayer Setup", "Installing...", "0%")
    While 1
     Local $aSize = DirGetSize("C:\KMPlayer", $DIR_EXTENDED)
     If Not @error Then
       Local $dat = ($aSize[1] + $aSize[2])/179
        If $dat > 0 Then ProgressSet($dat*100, Round($dat*100) & "%", "Installing...")
        If $dat*100 >= 100 then
     ProgressSet(100, "100%", "")
            Sleep(500)
     ExitLoop
     EndIf
       Sleep(100)
     EndIf
    WEnd
    ProgressOff()
    MsgBox(64, "", "Installation Completed.", 5)
    Exit

    SendKeys KMPlayer Setup Sample:

    Code:

    Run("kmplayer-4-1-2-2.exe")
    Sleep(100)
    If WinWaitActive("Installer La", "Please se") Then Send("{Enter}")
    Sleep(7000)
    If WinWaitActive("KMPlayer 4.1.2.2 Setup", "Welcome to", 1) Then Send("{Enter}{Enter}{Enter}{Enter}")

    ใช้ AutoItX VBScript (*.vbs)

    Code:

    'AutoItX : KMPlayer_setup.vbs

    ret = MsgBox("Do you wanted to Install?", 36, "KMPlayer Setup")
    If ret = 6 Then
      Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
      pid = oAutoIt.Run ("kmplayer-4-1-2-2.exe /S")
      oAutoIt.Sleep(100)
      If oAutoIt.WinWaitActive("Installer La", "Please se") Then oAutoIt.Send("{Enter}")
      oAutoIt.Sleep(7000)
      If oAutoIt.WinWaitActive("KMPlayer 4.1.2.2 Setup", "Welcome to", 1) Then oAutoIt.Send("{Enter}{Enter}{Enter}{Enter}")
      Do
        oAutoIt.Sleep(100)
        If oAutoIt.ProcessExists (pid) = 0 Then Exit Do
      Loop
      MsgBox "Installation Completed.", 64, "KMPlayer Setup"
    Else
      MsgBox "Setup later.", 0, "KMPlayer Setup"
    End If
    Set oAutoIt = Nothing

      เวลาขณะนี้ 03/05/24, 09:20 am