Jump to content

Recommended Posts

Posted

I used the time to write and design of this 5 hour

But have not done well. Order to install the program automatically, but currency. Exe only

Order to install the currency. Msi not. Write a lot of additional commands.

Next time if the author has complete Will bring down the new

If you write any more. Help with writing. :)

#NoTrayIcon
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>

Opt("MustDeclareVars", 1)

Global $hForm, $Inp_path, $Input_silent, $Combo_silent, $Sel_Btn, $Btn_setup
Global $sFile = @ProgramFilesDir & '\AutoIt3\Aut2Exe\Icons\SETUP09.ICO'
Global $nMsg, $tablefiles, $silent, $vartype, $pid
Global $dlgmessage = 'Choose a program setup'
Global $dlgopt = 'Program setup (*.exe)|Program setup (*.msi)'
Global $startmessage = 'Installing..Please wait!'
Global $endmessage = 'Installation complete.'
Global $waitmessage = 'Please wait!..Writing Script, Cannot use.'
Global $program, $parameter, $msgmessage


$hForm = GUICreate("Auto Installer Manager", 315, 162, -1, -1, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
GUISetBkColor(0xC0DCC0)
GUISetIcon($sFile)
$Inp_path = GUICtrlCreateInput("", 8, 32, 228, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN), _
BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Input_silent = GUICtrlCreateInput("", 8, 83, 225, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN), _
BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateLabel("SourcePath", 96, 15, 60, 17)
GUICtrlCreateLabel("Parameters", 96, 65, 57, 17)
$Combo_silent = GUICtrlCreateCombo("", 240, 83, 65, 25, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetData(-1, "/verysilent /sp-|/S|/s|qn|qb|/s/v /qn|/s /a /s /sms /f1|/quiet|")
GUICtrlSetState(-1, $GUI_DISABLE)
$Sel_Btn = GUICtrlCreateButton("Browse", 240, 32, 67, 21, BitOR($BS_CENTER,$WS_GROUP))
GUICtrlSetCursor (-1, 0)
$Btn_setup = GUICtrlCreateButton("Install", 112, 128, 75, 25, $WS_GROUP)
GUICtrlSetCursor (-1, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Sel_Btn
            $tablefiles = FileOpenDialog($dlgmessage, @DesktopDir & "/", $dlgopt, 1 + 4, "", $hForm)
            If Not @error Then
                GUICtrlSetData($Inp_path, $tablefiles)
                GUICtrlSetState($Combo_silent, $GUI_ENABLE)
            EndIf
        Case $Combo_silent
            $silent = GUICtrlRead($Combo_silent)
            GUICtrlSetData($Input_silent, $silent)
            GUICtrlSetState(-1, $GUI_ENABLE)
        Case $Btn_setup
            $vartype = GUICtrlRead($Inp_path)
            If StringInStr($vartype, '.exe') Then
                _exesetup()
            Else
                _msisetup()
            EndIf
    EndSwitch
WEnd

Func _exesetup()
    $program = GUICtrlRead($Inp_path)
    $parameter = GUICtrlRead($Input_silent)
    $pid = Run($program&' '&$parameter)
    If @error Then Exit
    ToolTip($startmessage, 450, 350, "")
    If ProcessWaitClose($pid) Then
        ToolTip($endmessage, 450, 350, "")
        Sleep(2000)
        ToolTip("")
    EndIf
EndFunc

Func _msisetup()
    ToolTip($waitmessage, 400, 300, "")
    Sleep(3000)
    ToolTip("")
EndFunc
Posted (edited)

Additional written instructions for installation of file. msi to. :)

#NoTrayIcon
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Process.au3>

Opt("MustDeclareVars", 1)

Global $hForm, $Inp_path, $Input_silent, $Combo_silent, $Sel_Btn, $Btn_setup
Global $sFile = @ProgramFilesDir & '\AutoIt3\Aut2Exe\Icons\SETUP09.ICO'
Global $nMsg, $tablefiles, $pathsplit, $silent, $vartype, $pid
Global $dlgmessage = 'Choose a program setup'
Global $dlgopt = 'Program setup (*.exe)|Program setup (*.msi)'
Global $startmessage = 'Installing..Please wait!'
Global $endmessage = 'Installation complete.'
Global $waitmessage = 'Please wait!..Writing Script, Cannot use.'
Global $program, $parameters, $msgmessage
Global $msi = 'msiexec /i'

$hForm = GUICreate("Auto Installer Manager", 315, 162, -1, 200, -1, BitOR($WS_EX_TOPMOST,$WS_EX_WINDOWEDGE))
GUISetBkColor(0xC0DCC0)
GUISetIcon($sFile)
$Inp_path = GUICtrlCreateInput("", 8, 32, 228, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN), _
BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetBkColor(-1, 0xFFFFFF)
$Input_silent = GUICtrlCreateInput("", 8, 83, 225, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_READONLY,$ES_WANTRETURN), _
BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetBkColor(-1, 0xFFFFFF)
GUICtrlCreateLabel("SourcePath", 96, 15, 60, 17)
GUICtrlCreateLabel("Parameters", 96, 65, 57, 17)
$Combo_silent = GUICtrlCreateCombo("", 240, 83, 65, 25, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetData(-1, "/verysilent /sp-|/S|/s|/qn|/qb|/s/v /qn|/s /a /s /sms /f1|/quiet|/passive")
GUICtrlSetState(-1, $GUI_DISABLE)
$Sel_Btn = GUICtrlCreateButton("Browse", 240, 32, 67, 21, BitOR($BS_CENTER,$WS_GROUP))
GUICtrlSetCursor (-1, 0)
$Btn_setup = GUICtrlCreateButton("Install", 112, 128, 75, 25, $WS_GROUP)
GUICtrlSetCursor (-1, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("Switches", 250, 68, 50, 15)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Sel_Btn
            $tablefiles = FileOpenDialog($dlgmessage, @DesktopDir & "/", $dlgopt, 1 + 4, "", $hForm)
            If Not @error Then
                $pathsplit = StringSplit($tablefiles, '\')
                For $i = 1 to UBound($pathsplit) - 1
                    If StringInstr($pathsplit[$i], '.') Then
                        $program = $pathsplit[$i]
                    EndIf
                Next
                GUICtrlSetData($Inp_path, $program)
                GUICtrlSetState($Combo_silent, $GUI_ENABLE)
            EndIf
        Case $Combo_silent
            $silent = GUICtrlRead($Combo_silent)
            GUICtrlSetData($Input_silent, $silent)
            GUICtrlSetState($Btn_setup, $GUI_ENABLE)
        Case $Btn_setup
            $vartype = GUICtrlRead($Inp_path)
            If StringInStr($vartype, '.exe') Then
                _exesetup()
            Else
                _msisetup()
            EndIf
    EndSwitch
WEnd

Func _exesetup()
    $program = GUICtrlRead($Inp_path)
    $parameters = GUICtrlRead($Input_silent)
    $pid = Run($program&' '&$parameters)
    If @error Then Exit
    ToolTip($startmessage, 445, 335, "")
    If ProcessWaitClose($pid) Then
        ToolTip($endmessage, 445, 335, "")
        Sleep(2000)
        ToolTip("")
    EndIf
EndFunc

Func _msisetup()
    $program = GUICtrlRead($Inp_path)
    $parameters = GUICtrlRead($Input_silent)
    $pid = Run($msi&' '&$program&' '&$parameters)
    If @error Then Exit
    ToolTip($startmessage, 445, 300, "")
    If ProcessWaitClose($pid) Then
        ToolTip($endmessage, 445, 300, "")
        Sleep(2000)
        ToolTip("")
    EndIf
EndFunc
Edited by sak
Posted (edited)

Use the plugin PeId v0.95 of the parameters automatically.

If an order where it should help with editing.

Plugin download:Click here :)

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Opt("MustDeclareVars", 1)

Global $hGUI, $Inp_prog, $Btn_sel, $Inp_param, $Btn_setup, $nMsg, $executable, $msipararam, $silent
Global $sFile = @ProgramFilesDir & '\AutoIt3\Aut2Exe\Icons\SETUP09.ICO'
Global $title_peid = 'PEiD v0.95', $plugin = @ScriptDir & '\Plugin\PEiD.exe'
Global $pluginchecked = 'Can not found..Plugin\PEiD.exe'
Global $guitext = 'AutoInstallParam'
Global $msimessage = 'Select change msi option'
Global $startmessage = 'Installing..Please wait!'
Global $endmessage = 'Installation complete.'
Global $filesplitpath, $program, $parameters, $pid, $var, $textstring, $idstring, $vartype, $parameter

If Not FileExists($plugin) Then
    MsgBox(48, "Error!", $pluginchecked)
    Exit
EndIf

$hGUI = GUICreate($guitext, 266, 162, -1, -1)
GUISetIcon($sFile)
$Inp_prog = GUICtrlCreateInput("", 16, 40, 153, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN), _
BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlCreateLabel("Program", 70, 23, 72, 17)
$Btn_sel = GUICtrlCreateButton("<>", 176, 40, 75, 23, $WS_GROUP)
$Inp_param = GUICtrlCreateInput("", 16, 88, 153, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_WANTRETURN), _
BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlCreateLabel("Parameters", 64, 71, 57, 17)
$Btn_setup = GUICtrlCreateButton("Install", 88, 128, 75, 25, $WS_GROUP)
GUICtrlSetCursor(-1, 0)
GUICtrlSetState(-1, $GUI_DISABLE)
$msipararam = GUICtrlCreateCombo("", 177, 88, 73, 25, -1, BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
GUICtrlSetData(-1, "/qn|/passive")
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel("MsiOption", 190, 71, 57, 15)
GUICtrlCreateLabel("Select", 195, 25, 57, 15)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Btn_sel
            $executable  = FileOpenDialog("Choose a file", @DesktopDir&"/", "Program file (*.exe;*.msi)", 1+4, "", $hGUI)
            If @error Then ContinueLoop
            $filesplitpath = StringSplit($executable , '\')
            GUICtrlSetData($Inp_prog, $filesplitpath[$filesplitpath[0]])
            $var = GUICtrlRead($Inp_prog)
            If StringInStr($var, '.exe') Then
                Run(@ScriptDir & '\Plugin\PEiD.exe -hard ' & '"' & $executable & '"', '', @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)
                _findparam()
                GUICtrlSetData($Inp_param, $parameters)
                GUICtrlSetState($msipararam, $GUI_DISABLE)
                GUICtrlSetState($Btn_setup, $GUI_ENABLE)
            Else
                GUICtrlSetData($Inp_param, $msimessage)
                GUICtrlSetState($Btn_setup, $GUI_DISABLE)
                GUICtrlSetState($msipararam, $GUI_ENABLE)
            EndIf
        Case $msipararam
            $silent = GUICtrlRead($msipararam)
            GUICtrlSetData($Inp_param, $silent)
            If $silent Then GUICtrlSetState($Btn_setup, $GUI_ENABLE)
        Case $Btn_setup
            $vartype = GUICtrlRead($Inp_prog)
            If StringInStr($vartype, '.exe') Then
                _exesetup()
            Else
                _msisetup()
            EndIf
    EndSwitch
WEnd

Func _findparam()
    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 = '/s /v"/qn"'
    ElseIf StringInStr($idstring, 'RAR SFX') Then
        $parameters = '/s'
    EndIf
       Return $parameters
EndFunc

Func _exesetup()
    $program = GUICtrlRead($Inp_prog)
    $parameters = GUICtrlRead($Inp_param)
    $pid = Run($program&' '&$parameters)
    If @error Then Exit
    ToolTip($startmessage, 448, 300, "")
    If ProcessWaitClose($pid) Then
        ToolTip("")
        MsgBox(64, "", $endmessage, "", $hGUI)
        _reset()
    EndIf
EndFunc

Func _msisetup()
    $program = GUICtrlRead($Inp_prog)
    $parameter = GUICtrlRead($Inp_param)
    $pid = Run('msiexec /i '& $program & ' ' & $parameter)
    If @error Then Exit
    ToolTip($startmessage, 448, 300, "")
    If ProcessWaitClose($pid) Then
        ToolTip("")
        MsgBox(64, "", $endmessage, "", $hGUI)
        _reset()
    EndIf
EndFunc

Func _reset()
    GUICtrlSetData($Inp_prog, '')
    GUICtrlSetData($Inp_param, '')
    GUICtrlSetState($msipararam, $GUI_DISABLE)
    GUICtrlSetState($Btn_setup, $GUI_DISABLE)
EndFunc
Edited by sak

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...