Sign in to follow this  
Followers 0
goodbyeplanet

Continue script after a reboot

12 posts in this topic

for example i have the code below which installs windows search. where would i put the code to continue installation of another application afte r it reboots? Thank you.

WinWaitActive("Setup for Windows Search")
Sleep(500)
Send("!s")
send("!w")

WinWaitActive("Setup for Windows Search","herzlich willkommen")
sleep(500)
send("{ENTER}")
shutdown (6)

In summary thie code does this:

Installs a package.

Reboots

Installs another package.

Reboots

Installs another package.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If you want to run your script with different input parameters then you have to specify them as input parameters.

There is no such thing as continuing execution after reboot. Execution starts from the beginning (with different parameters).

Open help file and search "Running Scripts". If you would have questions then, ask (then).

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

There is no such thing as continuing execution after reboot

I didnt know its an impossible task. Thanks for clarifying. I also checked running scripts in the help file but it doesnt seem to explain clearly.

i forgot to mention that in my code I check first my log file if current application value has been set to YES which means installation DONE. If this value is YES then application does not install but instead moves down and searches for another uninstalled application. my only problem is those applications that need a restart and then contiuning with others after reboot.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I didnt know its an impossible task. Thanks for clarifying. I also checked running scripts in the help file but it doesnt seem to explain clearly.

i forgot to mention that in my code I check first my log file if current application value has been set to YES which means installation DONE. If this value is YES then application does not install but instead moves down and searches for another uninstalled application. my only problem is those applications that need a restart and then contiuning with others after reboot.

There are no applications that need restart before continuing with others. You are misinterpreting.

There are applications that require restart to complete the un-instalation process (removing those files that were 'locked'). This can be done anytime in the future, doesn't have to be immediately. Usually the job is left for the system to finish on reboot by writing to registry.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

I would do it this way:

Start program with parameter 1: MyApp.exe 1

Within the script check the parameter and execute your subroutine 1

Create a new string in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce -> MyApp.exe 2 to execute

function 2 after reboot.

etc.

I hope it helps.

Br,

UEZ


Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

There are no applications that need restart before continuing with others. You are misinterpreting.

There are applications that require restart to complete the un-instalation process (removing those files that were 'locked'). This can be done anytime in the future, doesn't have to be immediately. Usually the job is left for the system to finish on reboot by writing to registry.

So this means that I can autoinstall all the applications , (almost 20 in my case) and ignore where it says restart and then do a single restart once all of them have been installed? in fcat three quarters of my applications dont need a restart except for 3 of them. so if i ignore the option to restart, and then do the restart all at once after all applications have been installed, will it not cause any problems...

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

There shouldn't be any problems. Unless there are some strange dependencies.

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I have posted this script already a couple of times. Just have a play with it:

; pgm name Install_With_Reboots.AU3
$Userid = "Administrator"
$Psw = "adminpsw"
; Remove autologin params from registry to clean up
SetAutoLogon("Off", "")
;
; retrieve param
$param1 = ""
If $CmdLine[0] > 0 Then
    $param1 = $CmdLine[1]
EndIf
; Act on it
Select
    Case $param1 = ""
        ; run your programs with admin account if needed in the first step
        ; *** put your stuff here for step1 ***
        RunAs($Userid, @ComputerName, $Psw, Default,"notepad.exe step1.txt")
        SetAutoLogon("On", "step1")
        Shutdown(6)
    Case $param1 = "step1"
        ; is already logged on with admin account
        ;
        ; *** put your stuff here for step2 ***
        RunWait("notepad.exe step2.txt")
        ;
        SetAutoLogon("On", "step2")
        Shutdown(6)
    Case $param1 = "step2"
        ; logoff the admin account
        ; *** put your stuff here for step3 ***
        RunWait("notepad.exe step3.txt")
        ; just logoff
        Shutdown(0)
        Exit
EndSelect
Exit
;
;
Func SetAutoLogon($sw, $step)
    Local $s1, $s2, $s3, $s4
    If $sw = "On" Then
        ; set the registry to start this program again after reboot
        ; Read  current settings
        $s1 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AutoAdminLogon")
        $s2 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultDomainName")
        $s3 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultUserName")
        $s4 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultPassword")
        ;Save current settings
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_AutoAdminLogon", "REG_SZ", $s1)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultDomainName", "REG_SZ", $s2)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultUserName", "REG_SZ", $s3)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultPassword", "REG_SZ", $s4)
        ;Set New Settings
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RUN", "AutoItInstaller", "REG_SZ", @ScriptFullPath & " " & $step)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AutoAdminLogon", "REG_SZ", "1")
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultDomainName", "REG_SZ", EnvGet("LOGONSERVER"))
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultUserName", "REG_SZ", $Userid)
        RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultPassword", "REG_SZ", $Psw)
    EndIf
    ;
    If $sw = "Off" Then
        ; Read  previous settings and reset
        $s1 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_AutoAdminLogon")
        If Not @error Then
            RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_AutoAdminLogon")
            RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "AutoAdminLogon", "REG_SZ", $s1)
        EndIf
        $s2 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultDomainName")
        If Not @error Then
            RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultDomainName")
            RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultDomainName", "REG_SZ",$s2)
        EndIf
        $s3 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultUserName")
        If Not @error Then
            RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultUserName")
            RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultUserName", "REG_SZ", $s3)
        EndIf
        $s4 = RegRead("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultPassword")
        If Not @error Then
            RegDelete("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "S_DefaultPassword")
            RegWrite("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\", "DefaultPassword", "REG_SZ", $s4)
        EndIf
        ; Remove/Reset the registrykey to start this program again after reboot
        RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RUN", "AutoItInstaller")
    EndIf
EndFunc   ;==>SetAutoLogon
Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Jos,

In your example what does this line mean:

RunAs($Userid, @ComputerName, $Psw, Default,"notepad.exe step1.txt")

I'm trying to install an application that requires a reboot.

Thanks for the help.

Manny

Share this post


Link to post
Share on other sites

Did you read the comment line above this RunAs() ? :)

It is just and example runas() statement were you should put your logic of the first step when the script is initial ran.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I do this all the time. I just posted a skeleton script in the Example Scripts forum

Share this post


Link to post
Share on other sites

Thanks figured it out. I guess my original questions did sound silly :-p Anyhoo thanks for all the examples!

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
Sign in to follow this  
Followers 0