sshrum Posted July 5, 2005 Share Posted July 5, 2005 I have a loop that deletes and copies files. I have set up the 'if GuiGetMsg() = $GUI_EVENT_CLOSE then' clause to invoke a msgbox that asks the user if they want to cancel during these operations. What I'm seeing is that once I hit the close button, it's not instantanious nor is it 5 secs later that I'm getting the prompt back. This is a problem as 5 or 6 files have either been deleted or copied beyond the point of the initial 'X' press. I tried putting in sleep(250) to release a bit of CPU time to the GUI but it makes no difference... Is there a way to increase the responsiveness of the GUI dialog controls when reporting to GuiGetMsg() = $GUI_EVENT_CLOSE that I'm missing? TIA Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
sshrum Posted July 6, 2005 Author Share Posted July 6, 2005 Here's my _PurgeFiles(). If $iProgress is enabled, the GUI is displayed. Func _PurgeFiles($aTemp, $i_base = 1); idea by Brenda Wallace if $sExtensions <> "" Then $aTemp = _ArrayFilter($aTemp, stringsplit($sExtensions,",")) $iPurgeCount = ubound($aTemp) - $i_base For $i = $i_base To ubound($aTemp) - $i_base sleep(250) if $iProgress = "1" then if GuiGetMsg() = $GUI_EVENT_CLOSE then if msgbox(4+16+256,$sApptitle, "Are you sure you want to cancel the current operation?") = 6 Then return -1 ExitLoop EndIf EndIf EndIf $aPath = StringSplit($aTemp[$i],"\") _NotifyUser("Purging " & $i & " of " & $iPurgeCount & " files", ($i/$iPurgeCount) * 100, Round(($i/$iPurgeCount) * 100, 0) & "%", $aPath[$aPath[0]]) $iDelete = 1 if $sExtensions <> "" Then $aExtension = StringSplit($aTemp[$i],".") $iDelete = StringInStr($sExtensions, $aExtension[$aExtension[0]]) EndIf if $iDelete <> 0 Then If FileDelete($aTemp[$i]) = 0 Then FileSetAttrib($aTemp[$i], "-R") FileDelete($aTemp[$i]) EndIf EndIf Next return 1 EndFunc ;==>_PurgeFiles Sean Shrum :: http://www.shrum.net All my published AU3-based apps and utilities 'Make it idiot-proof, and someone will make a better idiot' Link to comment Share on other sites More sharing options...
Valuater Posted July 6, 2005 Share Posted July 6, 2005 try this If GuiGetMsg() = $GUI_EVENT_CLOSE then $ans = msgbox(4+16+256,$sApptitle, "Are you sure you want to cancel the current operation?") If $ans = 6 Then return -1 ExitLoop EndIf EndIf I believe ( not absolute) your message box, as you have written it, allows the for/next loop to continue. I did not think this was possible with a message box. Please let me know if this works for you 8) 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