Jump to content

Silent installer for systeminfo.hta


Recommended Posts

Hello, i want to make a silent installer with autoit. The Project is very easy.

Step 1: copy the file SystemInfo.hta into the folder "C:\Program Files\Common Files\ZDV\Systeminfo"

Step 2: Create a shortcut on the Desktop which refrences to the SystemInfo.hta (full path = C:\Program Files\Common Files\ZDV\Systeminfo\SystemInfo.hta)

 

(the file SystemInfohta.txt has to be renamed after download to SystemInfo.hta)

 

SystemInfohta.txt

Link to post
Share on other sites
12 minutes ago, webmasterfcn said:

The Project is very easy.

Yes. it is. Furthermore, you have already received useful hints in the DE forum. What have you done so far ?

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites

..and since I suffer from OOD ( obsessive, obsessive Days )
 

#include <Debug.au3>

_DebugArrayDisplay(wmicArray("wmic path Win32_ComputerSystemProduct"), "Win32_ComputerSystemProduct")

Func wmicArray($sQuery)
    Local $iErr, $sStr = _RunWaitEx($sQuery)
    $iErr = @extended ; all this "text to array" takes 1 ms. or so
    Local $n = 1, $aStr = StringSplit($sStr, @CR & @CRLF, 1)
    For $n = 1 To $aStr[0]
        If StringLen($aStr[$n]) = 0 Then ExitLoop
    Next
    If $n = 1 Then Return SetError(4)
    ReDim $aStr[$n]
    $aStr[0] = $n - 1
    Local $aCaptions = StringSplit(StringStripWS($aStr[1], 7), " ", 2)
    Local $aRet[UBound($aCaptions)][$n]
    For $n = 0 To UBound($aCaptions) - 1
        $aRet[$n][0] = $aCaptions[$n]
        $aRet[$n][UBound($aRet, 2) - 1] = StringInStr($aStr[1], "  " & $aCaptions[$n] & "  ")
    Next
    For $m = 2 To $aStr[0]
        For $n = UBound($aRet) - 1 To 0 Step -1
            $aRet[$n][$m - 1] = StringStripWS(StringTrimLeft($aStr[$m], $aRet[$n][UBound($aRet, 2) - 1] - 1), 3)
            $aStr[$m] = StringLeft($aStr[$m], $aRet[$n][UBound($aRet, 2) - 1] - 1)
        Next
    Next
    ReDim $aRet[UBound($aRet)][UBound($aRet, 2) - 1]
    Return $aRet
EndFunc   ;==>wmicArray


; https://www.autoitscript.com/forum/topic/139260-autoit-snippets/?do=findComment&comment=1478119
Func _RunWaitEx($sCommand, $sWorkingDir = @TempDir, $iShowFlag = @SW_HIDE, $msTimeout = 0)

    ; ------------------- GetExitCodeProcess portion
    Switch $sWorkingDir
        Case "/OpenProcess"
            Local $hPID_HANDLE = DllCall('kernel32.dll', 'ptr', 'OpenProcess', 'int', 0x400, 'int', 0, 'int', $sCommand)
            If Not @error Then Return $hPID_HANDLE
            Return SetError(1, 0, 0)
        Case "/GetExitCodeProcess"
            Local $v_Placeholder, $aRet = DllCall('kernel32.dll', 'ptr', 'GetExitCodeProcess', 'ptr', $sCommand[0], 'int*', $v_Placeholder)
            If Not @error And UBound($aRet) > 2 Then Return $aRet[2]
            Return SetError(1, 0, 0)
        Case "/CloseHandle"
            DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $sCommand)
            If Not @error Then Return 1
            Return 0
    EndSwitch

    ; ------------------- set defaults
    If $sWorkingDir = Default Then $sWorkingDir = @TempDir
    If $iShowFlag = Default Then $iShowFlag = @SW_HIDE
    If $msTimeout = Default Then $msTimeout = 0 ; ( 0 ms. = OFF ) in case the process takes longer than expected

    ; ------------------- Run()
    Local $iPID = Run(@ComSpec & " /c " & $sCommand, @TempDir, @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD))
    If @error Or $iPID = 0 Then Return SetError(@error + 100, 0, "")
    Local $iExitCode = 0, $hPID_HANDLE = _RunWaitEx($iPID, "/OpenProcess")
    Local $hTimer = TimerInit(), $sOutput = ""
    While 1
        $sOutput &= StdoutRead($iPID)
        If @error Then ExitLoop
        If $msTimeout And TimerDiff($hTimer) > $msTimeout Then ExitLoop
        Sleep(1)
    WEnd
    While 1
        $sOutput &= StderrRead($iPID)
        If @error Then ExitLoop
        If $msTimeout And TimerDiff($hTimer) > $msTimeout Then ExitLoop
        Sleep(1)
    WEnd
    If $hPID_HANDLE <> 0 Then
        $iExitCode = _RunWaitEx($hPID_HANDLE, "/GetExitCodeProcess")
        If $iExitCode = 259 Then
            $iExitCode = 100000 + $iPID ; ...process not done, should not close handle.
        Else ;                            ...the PID will be the @extended - 100000
            _RunWaitEx($hPID_HANDLE, "/CloseHandle")
        EndIf
    EndIf
    Return SetError($msTimeout And TimerDiff($hTimer) > $msTimeout ? 200 : 0, $iExitCode, $sOutput)
EndFunc   ;==>_RunWaitEx

 

Link to post
Share on other sites

I 'm sorry that i created this Thread. My Problem was that i didn't realized that AutoIt has seperate German and English Forum. My mistake was i searched in the English Forum but didn'd find anythig about systeminfo.hta! So i made this Thread. Yes i should realize that there a 2 separte Forums but i didn't

So for now i will write my code in the German Forum.

 

Maybe anycone can close this Thread!

Link to post
Share on other sites

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...