chiners_68 Posted January 24, 2007 Posted January 24, 2007 can somonehelp fix this so it exits the script when the red X is clicked to close the window.ive created this automatic script for defragmenting which has a skip button to cancel if not required. the button & script works a treat just not the close window button.Opt("GUIOnEventMode", 1) ; Change to OnEvent mode$started = 1$mainwindow = GUICreate("Defragmentation", 200, 100) GUICtrlCreateLabel("Automating defrag in 6 seconds", 30, 10)$btnExit = GUICtrlCreateButton("Skip", 70, 50, 60);GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate")GUICtrlSetOnEvent($btnExit, "_Terminate")GUISetState(@SW_SHOW)While 1 Sleep(6000) If $started Then Run("defrag.exe c: -f", "", @SW_HIDE) EndIf ExitWendFunc _Terminate() $started = 0 ExitEndFunc
Danny35d Posted January 24, 2007 Posted January 24, 2007 You need to add #include <GUIConstants.au3> at the beging of the script. Also remove the semicolon from ;GUISetOnEvent($GUI_EVENT_CLOSE, "_Terminate") AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now