Jump to content

exit if set up exited?


Recommended Posts

hi

i have created unattended installation for a software

i want to add function to script so if at any point of installation the user exit the installation the script exit from memory too

these are the lines

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Run("Setup.exe")

WinWait("Welcome to the MathWorks Installer","")

If Not WinActive("Welcome to the MathWorks Installer","") Then WinActivate("Welcome to the MathWorks Installer","")

WinWaitActive("Welcome to the MathWorks Installer","")

Send("{ENTER}")

WinWait("License Information","")

If Not WinActive("License Information","") Then WinActivate("License Information","")

WinWaitActive("License Information","")

Send("amir{TAB}ali{TAB}")

WinWait("Program Manager","")

If Not WinActive("Program Manager","") Then WinActivate("Program Manager","")

WinWaitActive("Program Manager","")

WinWait("License Information","")

If Not WinActive("License Information","") Then WinActivate("License Information","")

WinWaitActive("License Information","")

Send("17-07731-23692-10568-44296-41368-55398-00447-58644-32358-48493-42354-15944-24217-41086-64008-44383-18129-65052-07135-50759-18518-30316-49442-20496-07027-48539-37608-12364-29464-62082-53145{TAB}{TAB}{TAB}{ENTER}")

WinWait("MathWorks Account","")

If Not WinActive("MathWorks Account","") Then WinActivate("MathWorks Account","")

WinWaitActive("MathWorks Account","")

Send("{SPACE}{TAB}{TAB}{SPACE}{ENTER}")

WinWait("License Agreement","")

If Not WinActive("License Agreement","") Then WinActivate("License Agreement","")

WinWaitActive("License Agreement","")

Send("{SPACE}{ENTER}")

WinWait("Installation Type","")

If Not WinActive("Installation Type","") Then WinActivate("Installation Type","")

WinWaitActive("Installation Type","")

Send("{ENTER}")

WinWait("Folder Selection","")

If Not WinActive("Folder Selection","") Then WinActivate("Folder Selection","")

WinWaitActive("Folder Selection","")

If WinExists("Folder Selection")=2 Then Exit(0)

If ProcessExists("Setup.exe")=0 Then Exit(0)

WinWait("Confirmation","")

If Not WinActive("Confirmation","") Then WinActivate("Confirmation","")

WinWaitActive("Confirmation","")

Send("{ENTER}")

i have added those two red lines but they do not work i donot know no where to add those lines or even they are correct or not

can someone guide me or modify script that way?

many thanks

Link to comment
Share on other sites

i want to add function to script so if at any point of installation the user exit the installation the script exit from memory too

You can do this in several ways.

One approach could be to check in every step of your automated installation if a window exists (If WinExists...). If not, to terminate your script.

Another approach is to use the AdlibEnable() function (see the helpfile). An example could be:

AdlibEnable("ErrorCheck")

; your script starts here

; your script ends here

Func ErrorCheck() ; Use any of the two 'If' statements, depending on your needs
    ;If Not WinExists("Welcome to the MathWorks Installer") Then Exit
    If Not ProcessExists("setup.exe") Then Exit
EndFuncoÝ÷ ØÚ0jÇÚ­«-ëp¢·)Þ±ªÞrÜz¹ÞvØ^¦ºé¢²ØZ·*.v÷öØZ½æ­g¨ºÛ¶íæ¢÷uж+Þ)ÞN¼¢¶Øb³²jëh×6WinWaitActive("Folder Selection","", 5) ; Use a timeout value here so as your script not to wait for ever
If WinExists("Folder Selection")=0 Then Exit(0) ; WinWaitActive never returns '2' - read the helpfile
Link to comment
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
 Share

  • Recently Browsing   0 members

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