Jump to content
Sign in to follow this  
DavidTunnell

if statement based on if delete popup happens

Recommended Posts

DavidTunnell

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.

Share this post


Link to post
Share on other sites
JLogan3o13

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
  • Like 1

√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

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  

×