chiners_68 Posted January 24, 2007 Author Posted January 24, 2007 MHZ, you have hit the nail on the head... ive just checked & it runs the GUI but as you said moves on to the next task. asfter the two GUI'for my Defrag run quicky it then moves onto the reboot while the defrag is in progress. rebooting odviously stops the defrag.how can i modify this then to run wait but still have the GUI disapear after my 6 seconds timeout. ive added a winclose but it dosent cles the window.#include <GUIConstants.au3>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 winclose("defragmentation") Runwait("defrag.exe c: -f", "", @SW_HIDE) EndIf ExitWendFunc _Terminate() $started = 0 ExitEndFunc
MHz Posted January 24, 2007 Posted January 24, 2007 Just delete the Gui as the script will continue in the background. #include <GUIConstants.au3> 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 GUIDelete($mainwindow) RunWait("defrag.exe c: -f", "", @SW_HIDE) EndIf Exit WEnd Func _Terminate() $started = 0 Exit EndFunc
chiners_68 Posted January 24, 2007 Author Posted January 24, 2007 (edited) works a treat MHZ from windows.. just testing from runonce.. thanks for all your help & patience. Edited January 24, 2007 by chiners_68
chiners_68 Posted January 24, 2007 Author Posted January 24, 2007 MHZ, im a happy man.. working a treat from runonce.
MHz Posted January 24, 2007 Posted January 24, 2007 MHZ, im a happy man.. working a treat from runonce.Glad to hear.
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