Jump to content

if statement based on if delete popup happens


Go to solution Solved by JLogan3o13,

Recommended Posts

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.
Link to comment
Share on other sites

  • Moderators
  • Solution

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

"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!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...