chiners_68 Posted January 24, 2007 Share 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 Link to comment Share on other sites More sharing options...
Danny35d Posted January 24, 2007 Share 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 Link to comment Share on other sites More sharing options...
chiners_68 Posted January 24, 2007 Author Share Posted January 24, 2007 excerlent... cheers Link to comment Share on other sites More sharing options...
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