DavidTunnell Posted September 10, 2013 Posted September 10, 2013 I am trying to figure out how to create an if contidional around whether a delete items popup happens. I have the following code: Send("{DELETE}") sleep(500) ControlFocus("Delete Multiple Items","","[iD:16779]") sleep(1000) ;click on save button ControlClick("Delete Multiple Items","","[iD:6]]") sleep(500) ControlFocus("Windows Explorer", "", "") Send("!+{F4}",0) But sometimes the folder is empty and if so I would like to skip it.
Moderators Solution JLogan3o13 Posted September 10, 2013 Moderators Solution Posted September 10, 2013 If you're looking to delete items out of a folder, I would suggest looking up RecFileListToArray in the Examples section. Something like this should work: #include <RecFileListToArray.au3> $dir = @DesktopDir & "\Test" Local $aArray = _RecFileListToArray($dir, "*", 1, 0, 1, 2) If IsArray($aArray) Then For $i = 1 To $aArray[0] FileDelete($aArray[$i]) Next Else MsgBox(0, "", "No files in directory") EndIf DavidTunnell 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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