Jump to content

Exiting AutoIt


 Share

Recommended Posts

Ive created a autoIt3 script that launches setup program Run(setup.exe) that makes the appropriate mouse clicks and installs a software package. Ive compiled the script to an executable. The software installs properly however, it appears that after the executable (compiled script) completes, the AutoIt application is still running. An AutoIT icon is in the system tray in a paused state. I have to manually click the AutoIT icon to exit AutoIT. My question is, is there a command that I need to put at the end of the script to tell AutoIT the script is finished and should exit the AutoIt program?

Link to comment
Share on other sites

Can you please post your code, so people will be able to help you a bit more?

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

Can you please post your code, so people will be able to help you a bit more?

Here is a copy of my script. Again, the application appears to install correctly, no problems there. Any insight you may have would be greatly appreciated!

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

Run('setup.exe')

; Screen #1

WinWait("InstallUpdates","Please enter the lan")

If Not WinActive("InstallUpdates","Please enter the lan") Then WinActivate("InstallUpdates","Please enter the lan")

WinWaitActive("InstallUpdates","Please enter the lan")

ControlFocus("InstallUpdates","Please enter the lan",1)

ControlClick("InstallUpdates","Please enter the lan",1,"left",1)

; Screen #2 - Welcome

WinWait("InstallUpdates","The InstallUpdates.e")

If Not WinActive("InstallUpdates","The InstallUpdates.e") Then WinActivate("InstallUpdates","The InstallUpdates.e")

WinWaitActive("InstallUpdates","The InstallUpdates.e")

ControlFocus("InstallUpdates","The InstallUpdates.e",1)

ControlClick("InstallUpdates","The InstallUpdates.e",1,"left",1)

; Screen #3 - 1 License Agreement

WinWait("InstallUpdates","I do not accept the ")

If Not WinActive("InstallUpdates","I do not accept the ") Then WinActivate("InstallUpdates","I do not accept the ")

WinWaitActive("InstallUpdates","I do not accept the ")

ControlFocus("InstallUpdates","I do not accept the ",1029)

ControlClick("InstallUpdates","I do not accept the ",1029,"left",1)

; Screen #3 - 2 License Agreement - Next

WinWaitActive("InstallUpdates","I do not accept the ")

ControlFocus("InstallUpdates","I do not accept the ",1028)

ControlClick("InstallUpdates","I do not accept the ",1028,"left",1)

; Screen #4 - 1 Service Startup Mode

WinWait("InstallUpdates","Do not Start Service")

If Not WinActive("InstallUpdates","Do not Start Service") Then WinActivate("InstallUpdates","Do not Start Service")

WinWaitActive("InstallUpdates","Do not Start Service")

ControlFocus("InstallUpdates","Do not Start Service",1010)

ControlClick("InstallUpdates","Do not Start Service",1010,"left",1)

; Screen #4 - 2 Service Startup Mode - Next

WinWaitActive("InstallUpdates","Do not Start Service")

ControlFocus("InstallUpdates","Do not Start Service",1)

ControlClick("InstallUpdates","Do not Start Service",1,"left",1)

; Screen #5 Finish Window

WinWait("InstallUpdates","Finish Window")

If Not WinActive("InstallUpdates","Finish Window") Then WinActivate("InstallUpdates","Finish Window")

WinWaitActive("InstallUpdates","Finish Window")

ControlFocus("InstallUpdates","Finish Window",1)

ControlClick("InstallUpdates","Finish Window",1,"left",1)

; Screen #6 (After Installation)

WinWait("After Installation","After installation, please click Next.")

If Not WinActive("After Installation","After installation, please click Next.") Then WinActivate("After Installation","After installation, please click Next.")

WinWaitActive("After Installation","After installation, please click Next.")

ControlFocus("After Installation","After installation, please click Next.",12325)

ControlClick("After Installation","After installation, please click Next.",12325,"left",1)

; Screen #7 Finish Admin Install - Finish

WinWait("Finish Admin Install","When the installation has ended")

If Not WinActive("Finish Admin Install","When the installation has ended") Then WinActivate("Finish Admin Install","When the installation has ended")

WinWaitActive("Finish Admin Install","When the installation has ended")

ControlFocus("Finish Admin Install","When the installation has ended",12325)

ControlClick("Finish Admin Install","When the installation has ended",12325,"left",1)

Sleep(1000)

WinClose

Exit

Link to comment
Share on other sites

Second line from the bottom has WinClose with no arguments. Try changing that as see if it makes a difference.

“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Link to comment
Share on other sites

i see that it sleeps/waits 1 second before it tries to close the install window

does the install window actually close

... if it does close then the "Exit" you have should work

i would suggest putting a messagebox between the last few lines to test where the program is hanging up

8)

EDIT

good one Stumpi... that should actually give an error ( i think )

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

I cannot stand redundant code! I suggest trying something like the following:

Opt("TrayIconDebug", 1); FOR DEBUGGING TO SEE IF PROGRAM GETS STUCK

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('setup.exe')

Dim $WindowTitle = "InstallUpdates"

MyClick($WindowTitle, "Please enter the lan", 1)      ; Screen #1
MyClick($WindowTitle, "The InstallUpdates.e", 1)      ; Screen #2 - Welcome
MyClick($WindowTitle, "I do not accept the ", 1029)   ; Screen #3 - 1 License Agreement
MyClick($WindowTitle, "I do not accept the ", 1028)   ; Screen #3 - 2 License Agreement - Next
MyClick($WindowTitle, "Do not Start Service", 1010)   ; Screen #4 - 1 Service Startup Mode
MyClick($WindowTitle, "Do not Start Service", 1)      ; Screen #4 - 2 Service Startup Mode - Next
MyClick($WindowTitle, "Finish Window", 1)            ; Screen #5 Finish Window

; Screen #6 (After Installation)
MyClick("After Installation", "After installation, please click Next.", 12325)

; Screen #7 Finish Admin Install - Finish
MyClick("Finish Admin Install", "When the installation has ended", 12325)

Exit


; Factor out reduntant code with this function.
; You might not even need the WinActivate / WinWaitActive / ControlFocus lines
Func MyClick($title, $win, $controlID)
    WinWait($title, $text)
    WinActivate($title, $text);need or not?
    WinWaitActive($title, $text);need or not?
    ControlFocus($title, $text, $controlID);need or not?
    ControlClick($title, $text, $controlID)
EndFunc

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

I cannot stand redundant code! I suggest trying something like the following:

Opt("TrayIconDebug", 1); FOR DEBUGGING TO SEE IF PROGRAM GETS STUCK

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('setup.exe')

Dim $WindowTitle = "InstallUpdates"

MyClick($WindowTitle, "Please enter the lan", 1)     ; Screen #1
MyClick($WindowTitle, "The InstallUpdates.e", 1)     ; Screen #2 - Welcome
MyClick($WindowTitle, "I do not accept the ", 1029)  ; Screen #3 - 1 License Agreement
MyClick($WindowTitle, "I do not accept the ", 1028)  ; Screen #3 - 2 License Agreement - Next
MyClick($WindowTitle, "Do not Start Service", 1010)  ; Screen #4 - 1 Service Startup Mode
MyClick($WindowTitle, "Do not Start Service", 1)     ; Screen #4 - 2 Service Startup Mode - Next
MyClick($WindowTitle, "Finish Window", 1)           ; Screen #5 Finish Window

; Screen #6 (After Installation)
MyClick("After Installation", "After installation, please click Next.", 12325)

; Screen #7 Finish Admin Install - Finish
MyClick("Finish Admin Install", "When the installation has ended", 12325)

Exit


; Factor out reduntant code with this function.
; You might not even need the WinActivate / WinWaitActive / ControlFocus lines
Func MyClick($title, $win, $controlID)
    WinWait($title, $text)
    WinActivate($title, $text);need or not?
    WinWaitActive($title, $text);need or not?
    ControlFocus($title, $text, $controlID);need or not?
    ControlClick($title, $text, $controlID)
EndFunc
I agree, redundant code is irritating. Just a little thing I noticed in the function definition: "Func MyClick($title, $win, $controlID)" You never use $win in the function (it is $text). Might want to update that.
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...