Sign in to follow this  
Followers 0
jben

Automating Nero and offering 2 routes issue

3 posts in this topic

#1 ·  Posted (edited)

I'm posting here in the hope that someone can save me from this nightmare.

So here goes, I have a script that automates the installation of Nero. This script will initially install nero and if its run again then it will update/repair nero.

If the user attempts to install Nero again then different forms appear, therefore I am trying to offer 2 routes for the automated script. However I have found that this doesnt seem to work because after the script completes it does not continue to the bottom line of the code.

Of to pray that someone can help me because this is really giving me a headache.

Ignoring the fact that the last piece of code is shellexecute (@ScriptDir & "\EXE\Nero6\Install\Setup.exe") as this is just for testing. The last piece of code should run after the rest has complete (thats where I get stuck) but i'm presuming my code is not right. Thanks

Here is the code:

shellexecute (@ScriptDir & "\EXE\Nero6\Install\Setup.exe") 
adlibenable('_WinUpdateInstall')

Func _WinUpdateInstall()

   If WinExists("Nero 6 Update Wizard","Welcome to the Update Wizard for Nero 6") Then 
        $ReturnedValue = ControlClick("Nero 6 Update Wizard","", "Next >","Button2")
        
        winwaitactive ("Nero 6 Update Wizard","Update")
        $ReturnedValue = ControlClick("Nero 6 Update Wizard","", "Update","Button8")
        $ReturnedValue = ControlClick("Nero 6 Update Wizard","", "Next >","Button2")
        winwaitactive ("Nero 6 Update Wizard","Please read the following license")
        $ReturnedValue = ControlClick("Nero 6 Update Wizard","", "I accept all terms of the preceding License Agreement","Button11")
        $ReturnedValue = ControlClick("Nero 6 Update Wizard","", "Next >","Button2")
        winwaitactive ("Nero 6 Update Wizard","Customer information.")
        $ReturnedValue = ControlClick("Nero 6 Update Wizard","", "Next >","Button2")
        winwaitactive ("Nero 6 Update Wizard","The Wizard has completed ")
        $ReturnedValue = ControlClick("Nero 6 Update Wizard","", "Finish","Button3")
    EndIf
endfunc

winwaitactive ("Nero 6 Installation Wizard","Welcome to the Installation Wizard")
$ReturnedValue = ControlClick("Nero 6 Installation Wizard","", "Next >","Button1")
winwaitactive ("Nero 6 Installation Wizard","Please read the following license agreement")
$ReturnedValue = ControlClick("Nero 6 Installation Wizard","", "I accept all terms of the preceding License Agreement","Button8")
$ReturnedValue = ControlClick("Nero 6 Installation Wizard","", "Next >","Button2")
winwaitactive ("Nero 6 Installation Wizard","Customer information.")
controlClick("Nero 6 Installation Wizard","", "1A20-0100-0003-2132-6345-8003","Edit3")
send ("{BS 40}");this will be sent if the Serial Number is already stored within the input box. This code
;will delete the contents of the Serial Number input box
controlClick("Nero 6 Installation Wizard","", "","Edit3");this code will select the input box And
; enter the Serial Number
send ("1A20-0100-0003-2132-6345-8003");serial number entered into input box
$ReturnedValue = ControlClick("Nero 6 Installation Wizard","", "Next >","Button2")
winwaitactive ("Nero 6 Installation Wizard","The Wizard has completed")
controlClick("Nero 6 Installation Wizard","", "Finish","Button3")

If $ReturnedValue = 0 Then MsgBox(0, "", "Failed to fully automate the installation of Nero")


shellexecute (@ScriptDir & "\EXE\Nero6\Install\Setup.exe")

The code above is basically suppose to check if ("Nero 6 Update Wizard","Welcome to the Update Wizard for Nero 6") form exists. If it does then the code within that function will be performed. Otherwise the normal install code will be performed.

Normal code is performed on initial installation (Nero is not currently installed) and Func _WinUpdateInstall() will be performed if the update wizard page appears (which will only appear if Nero has already been installed)

Edited by jben

Share this post


Link to post
Share on other sites



Perhaps more like this:

ShellExecute(@ScriptDir & "\EXE\Nero6\Install\Setup.exe")

$iTimer = TimerInit()
While 1
    If WinExists(("Nero 6 Installation Wizard","Welcome to the Installation Wizard") Then
        _WinFirstInstall()
        ExitLoop
    ElseIf WinExists("Nero 6 Update Wizard","Welcome to the Update Wizard for Nero 6") Then
        _WinUpdateInstall()
        ExitLoop
    EndIf
    Sleep(100)
    
    ; Watch for 30Sec timeout
    If TimerDiff($iTimer) > 30000 Then 
        MsgBox(16, "Error!", "Setup.exe did not launch before 30sec timeout!")
        Exit
    EndIf
WEnd

Func _WinUpdateInstall()
    
    ; Process to update the existing install...
    
EndFunc   ;==>_WinUpdateInstall

Func _WinFirstInstall()
    
    ; Process to install for the first time...
    
EndFunc   ;==>_WinFirstInstall

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Just had a little play with that code and got it to work. Fantastic stuff.

Cheers mate.

;-)

Edited by jben

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