e45678mail

Hot to continue that autoIT script after reboot

2 posts in this topic

#1 ·  Posted

I have build a driver auto installation patch,

and find some drivers will force reboot after silent install,

have any method able to keeping the process for script?

Share this post


Link to post
Share on other sites



#2 ·  Posted

How I would do it is use an Ini file for each package for example:

[Package]
1=RunWait(@ScriptDir & '\Package1\Setup.exe /s')
2=RunWait(@ScriptDir & '\Package2\Setup.exe /s')

In your Au3 Script I would add a scheduled task that will run the script on logon until it completes something like:

#NoTrayIcon
#RequireAdmin

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
://////=__=
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <Array.au3>
Global $sREG_PACKAGE = 'HKLM\SOFTWARE\Package'
Global $hINI_PACKAGE = @ScriptDir & '\Package.ini'
Global $aINI_SECTION = IniReadSection($hINI_PACKAGE, 'Package')
    If @error Then Exit
Global $iINI_SECTION = Number(RegRead($sREG_PACKAGE, 'Package'))
    If $iINI_SECTION = '' Then $iINI_SECTION = 1

;~ Create a Scheduled Task
RunWait(@ComSpec & ' /c SchTasks /Create /SC ONLOGON /TN "' & FileGetVersion(@ScriptFullPath, 'ProductName') & '" /TR "' @ScriptFullPath & '" /ru "Domain\User /rp "Password"', '', @SW_HIDE)

For $x = $iINI_SECTION To $aINI_SECTION[0][0]
    ConsoleWrite('RegWrite("' & $sREG_PACKAGE & '", "Package", "REG_SZ", "' & $aINI_SECTION[$x][0] & '")' & @CRLF)
    ConsoleWrite('_Execute(' & $aINI_SECTION[$x][1] & ')' & @CRLF)
Next
ConsoleWrite('RegDelete("' & $sREG_PACKAGE '")' & @CRLF)

;~ Delete the Scheduled Task
RunWait(@ComSpec & ' /c SchTasks /Delete /TN "' & FileGetVersion(@ScriptFullPath, 'ProductName') & '"', '', @SW_HIDE)

Func _Execute($hPKG_EXECUTE)
    Local $iPID_EXECUTE = Execute($hPKG_EXECUTE)
    While ProcessExists($iPID_EXECUTE)
        Sleep(100)
    WEnd
    ;~ Check for Reboot Requirements here
EndFunc

Just really thinking out of the box, haven't tested but should work.

Share this post


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