Announcement

Collapse
No announcement yet.

Advance Auto Installer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Advance Auto Installer

    เป็นโปรแกรมที่เขียนขึ้นจาก Autoit v3 ผลงานของ อ.sak2005
    เป็นโปรแกรมที่ใช้สำหรับติดตั้งโปรแกรมต่างๆแบบอัตโนมัติ
    โปรแกรมนี้ที่พิเศษคือ แจก parameter อัตโนมัติ
    ลองนำไปศึกษาและใช้งานดูครับ (แจกSourceCodeฟรี)
    Download:Click here


  • #2
    อันนี้แก้bugมาให้ โปรแกรมทำงานได้สมบูรณ์ขึ้น
    Download:Click here

    Comment


    • #3
      ScriptCode
      ;--------------------------------------start script---------------------------
      #include <ButtonConstants.au3>
      #include <EditConstants.au3>
      #include <GUIConstantsEx.au3>
      #include <ProgressConstants.au3>
      #include <StaticConstants.au3>
      #include <WindowsConstants.au3>
      #Include <Date.au3>

      Global $title_peid = 'PEiD v0.94'

      ;create gui
      GUICreate("Advance Auto Installer v 2.0", 320, 179, 353, 292)
      GUISetBkColor(0xC0DCC0)
      $Progress1 = GUICtrlCreateProgress(9, 25, 302, 17)
      $Button1 = GUICtrlCreateButton("Browse", 238, 62, 75, 25, $WS_GROUP)
      GUICtrlSetCursor(-1, 0)
      GUICtrlSetTip(-1, "Select program to install.")
      $Input1 = GUICtrlCreateInput("", 82, 64, 155, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY), _
      BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
      $Input2 = GUICtrlCreateInput("", 104, 104, 115, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY), _
      BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
      $Button2 = GUICtrlCreateButton("Install", 124, 144, 75, 25, $WS_GROUP)
      GUICtrlSetCursor(-1, 0)
      GUICtrlSetTip(-1, "Auto install.")
      GUICtrlSetState(-1, $GUI_DISABLE)
      $Label1 = GUICtrlCreateLabel("Exit", 300, 165, 21, 17, $SS_CENTER)
      GUICtrlSetColor(-1, 0xFF0000)
      GUICtrlSetCursor(-1, 0)
      GUICtrlSetTip(-1, "Close")
      GUICtrlCreateLabel("ProgramName:", 10, 66, 70, 17)
      GUICtrlCreateLabel("Parameters:", 45, 106, 60, 17)
      $Label2 = GUICtrlCreateLabel("Progression", 130, 6, 59, 17, $SS_CENTER)
      GUICtrlCreateLabel("by:sak2005", 1, 145, 59, 17, $SS_CENTER)
      GUICtrlSetState(-1, $GUI_DISABLE)
      $Label3 = GUICtrlCreateLabel("dd//mm//yyyy", 1, 162, 52, 17, $SS_CENTER)
      GUICtrlSetState(-1, $GUI_DISABLE)
      GUICtrlSetData($Label3, _NowDate())

      GUISetState(@SW_SHOW)

      While 1
      $nMsg = GUIGetMsg()
      Switch $nMsg
      Case $GUI_EVENT_CLOSE
      Exit
      Case $Label1
      ExitLoop
      Case $Button1 ;file browse and run plugin (PEiD) scan search type installer.
      $executable = FileOpenDialog("Select a file to install", @DesktopDir & "|", _
      "Program Setup (*.exe;*.msi)", 1 + 4)
      If Not $executable Then ContinueLoop
      Run(@ScriptDir & '\Plugin\PEiD.exe -hard ' & '"' & $executable & '"')
      WinSetState($title_peid, '', @SW_HIDE)
      $textstring = ControlGetText($title_peid, '', 'Edit1')
      $idstring = ControlGetText($title_peid, '', 'Edit2')
      While ($idstring = 'Scanning...') Or ($idstring = '')
      $textstring = ControlGetText($title_peid, '', 'Edit1')
      $idstring = ControlGetText($title_peid, '', 'Edit2')
      WEnd
      WinClose($title_peid)
      ; file path split for file.exe
      Select
      Case StringInStr($executable, 'exe')
      $StringSp = StringSplit($Executable, '\')
      If StringInStr($StringSp[2], 'exe') Then
      $install = $StringSp[2]
      ElseIf StringInStr($StringSp[3], 'exe') Then
      $install = $StringSp[3]
      ElseIf StringInStr($StringSp[4], 'exe') Then
      $install = $StringSp[4]
      ElseIf StringInStr($StringSp[5], 'exe') Then
      $install = $StringSp[5]
      ElseIf StringInStr($StringSp[6], 'exe') Then
      $install = $StringSp[6]
      ElseIf StringInStr($StringSp[7], 'exe') Then
      $install = $StringSp[7]
      ElseIf StringInStr($StringSp[8], 'exe') Then
      $install = $StringSp[8]
      EndIf
      ;scan type installer file.exe and parameters.
      If StringInStr($idstring, 'Inno') Or StringInStr($idstring, 'Borland') Then
      $parameters = '/sp- /verysilent'
      ElseIf StringInStr($idstring, 'Nullsoft') Then
      $parameters = '/S'
      ElseIf StringInStr($idstring, 'Wise') Then
      $parameters = '/s'
      ElseIf StringInStr($idstring, 'InstallShield AFW') Then
      $parameters = '/s /a /s /sms /f1"" /f2""'
      ElseIf StringInStr($idstring, 'InstallShield 2003') Then
      $parameters = '/v"/qn"'
      ElseIf StringInStr($idstring, 'RAR SFX') Then
      $parameters = '/s'
      Else ;check error! if cann't found parameters
      MsgBox(48, "Error!" , "Cann't found Parameters" & @CRLF & "This's a program cann't run or install.")
      _reset()
      ContinueLoop

      EndIf
      GUICtrlSetData($Input1, $install)
      GUICtrlSetData($Input2, $parameters)
      GUICtrlSetState($Button2, $GUI_ENABLE)
      ;file path split for file.msi and parameters.
      Case StringInStr($Executable, 'msi')
      $StringSp = StringSplit($Executable, '\')
      If StringInStr($StringSp[2], 'msi') Then
      $install = $StringSp[2]
      ElseIf StringInStr($StringSp[3], 'msi') Then
      $install = $StringSp[3]
      ElseIf StringInStr($StringSp[4], 'msi') Then
      $install = $StringSp[4]
      ElseIf StringInStr($StringSp[5], 'msi') Then
      $install = $StringSp[5]
      ElseIf StringInStr($StringSp[6], 'msi') Then
      $install = $StringSp[6]
      ElseIf StringInStr($StringSp[7], 'msi') Then
      $install = $StringSp[7]
      ElseIf StringInStr($StringSp[8], 'msi') Then
      $install = $StringSp[8]
      EndIf
      GUICtrlSetData($Input1, 'msiexec /i' & ' ' & $install)
      GUICtrlSetData($Input2, '/qn')
      GUICtrlSetState($Button2, $GUI_ENABLE)
      EndSelect
      Case $Button2
      GUICtrlSetState($Button2, $GUI_DISABLE)
      Select ;run or installer program setup.exe
      Case StringInStr($executable, 'exe')
      Dim $pid
      $pid = Run($install & ' ' & $Parameters)
      GUICtrlSetData($Label2, "Installing...")
      GUICtrlSetColor($Label2, 0x0000FF)
      Dim $i = 0
      While ProcessExists($pid)
      GUICtrlSetData($Progress1, $i)
      $i = $i + 1
      Sleep(20)
      If $i > 100 Then $i = 0
      If ProcessExists($pid) = 0 Then ExitLoop
      WEnd
      ProcessWaitClose($pid)
      Sleep(500)
      GUICtrlSetData($Progress1, 100)
      Sleep(500)
      GUICtrlSetData($Label2, "")
      MsgBox(64, "" ,"Completed.")
      _reset()
      ;run or installer program setup.msi
      Case StringInStr($executable, 'msi')
      GUICtrlSetState($Button2, $GUI_DISABLE)
      $Parameters = '/qn'
      Dim $pid
      $pid = Run('msiexec /i' & ' ' & $install & ' ' & $Parameters)
      Dim $i = 0
      While ProcessExists($pid)
      GUICtrlSetData($Progress1, $i)
      $i = $i + 1
      Sleep(20)
      If $i > 100 Then $i = 0
      If ProcessExists($pid) = 0 Then ExitLoop
      WEnd
      ProcessWaitClose($pid)
      Sleep(500)
      GUICtrlSetData($Progress1, 100)
      Sleep(500)
      MsgBox(64, "" ,"Completed.")
      _reset()
      EndSelect
      EndSwitch
      WEnd
      ;refresh function.
      Func _reset()
      GUICtrlSetData($Label2, "Progression")
      GUICtrlSetColor($Label2, 0x000000)
      GUICtrlSetData($Progress1, 0)
      GUICtrlSetData($Input1, "")
      GUICtrlSetData($Input2, "")
      GUICtrlSetState($Button2, $GUI_DISABLE)
      EndFunc
      ;--------------------------------------end script----------------------------
      Last edited by sak2005; 15 May 2010, 19:49:22.

      Comment


      • #4
        ขอบคุณสำหรับ Source Code ครับผม ^^

        Comment

        Working...
        X