Jump to content
Sign in to follow this  
unclefishy

on exit... delete this folder

Recommended Posts

unclefishy

i have this:

all i need it to do is have it delete this directory upon exit... it works when i click the done button but not by closing the window by other means... :)

Func Keep_Open()
    Do
        $msg = GUIGetMsg()
        ;This checks the state of the Checkbox if it is checked or 1 then it will set the variable to that.
        $VarStatus1 = GUICtrlRead($Var1_CHKBOX)
        $VarStatus2 = GUICtrlRead($Var2_CHKBOX)
        $VarStatus3 = GUICtrlRead($Var3_CHKBOX)
        $VarStatus4 = GUICtrlRead($Var4_CHKBOX)
        
    Until $msg = $RUN Or $msg = $EXIT Or $msg = $GUI_EVENT_CLOSE
    
    If $msg = $EXIT Then DirRemove("c:\ntst-tmp", 1) 
    Exit
    If $msg = $GUI_EVENT_CLOSE Then DirRemove("c:\ntst-tmp", 1) Exit
    ;If the status is 1 for the variable checkboxes when run is hit, it will execute those lines below which call the functions
    If $VarStatus1 = 1 Then Call("ITEM_1")
    If $VarStatus2 = 1 Then Call("ITEM_2")
    If $VarStatus3 = 1 Then Call("ITEM_3")
    If $VarStatus4 = 1 Then Call("ITEM_4")
    Call("Keep_Open")
EndFunc   ;==>Keep_Open

Share this post


Link to post
Share on other sites
EndFunc

i have this:

all i need it to do is have it delete this directory upon exit... it works when i click the done button but not by closing the window by other means... :)

Func Keep_Open()
    Do
        $msg = GUIGetMsg()
        ;This checks the state of the Checkbox if it is checked or 1 then it will set the variable to that.
        $VarStatus1 = GUICtrlRead($Var1_CHKBOX)
        $VarStatus2 = GUICtrlRead($Var2_CHKBOX)
        $VarStatus3 = GUICtrlRead($Var3_CHKBOX)
        $VarStatus4 = GUICtrlRead($Var4_CHKBOX)
        
    Until $msg = $RUN Or $msg = $EXIT Or $msg = $GUI_EVENT_CLOSE
    
    If $msg = $EXIT Then DirRemove("c:\ntst-tmp", 1) 
    Exit
    If $msg = $GUI_EVENT_CLOSE Then DirRemove("c:\ntst-tmp", 1) Exit
    ;If the status is 1 for the variable checkboxes when run is hit, it will execute those lines below which call the functions
    If $VarStatus1 = 1 Then Call("ITEM_1")
    If $VarStatus2 = 1 Then Call("ITEM_2")
    If $VarStatus3 = 1 Then Call("ITEM_3")
    If $VarStatus4 = 1 Then Call("ITEM_4")
    Call("Keep_Open")
EndFunc   ;==>Keep_Open

EndFuncAutoIt is the shiznit. I love it.

Share this post


Link to post
Share on other sites
Gigglestick

Change...

If $msg = $EXIT Then DirRemove("c:\ntst-tmp", 1) 
    Exit
    If $msg = $GUI_EVENT_CLOSE Then DirRemove("c:\ntst-tmp", 1) Exit

The Exit statements after your DirRemove's are not encapsulated in the If statement before them.


My UDFs: ExitCodes

Share this post


Link to post
Share on other sites
unclefishy

thanks guys... i was confused by the nesting of if's... and else if... or what...

sorry for being so scatterbrained today... thank god tomorrow is friday :)

Share this post


Link to post
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
Sign in to follow this  

×