I am trying to add an "if" statement after my second dialog.

I started working on another installer our company is needing. One of our dialogs asks the user to point to a certain directory on their computer, once they have and click next, we would like the installer to run an if statement and check to see if a file is in the directory they specified, if it is not, we would like it to pop up a message saying click back and pick the correct directory. I hope that made sense.

The problem is that the if statement doesn't seem to be running in the proper place. No matter where I have placed the if statement in the script, the if statement shows up at the incorrect time when running the installer, either before the installer pops up or during the installation portion. Where do I need to place the if statement in my script to have it pop uo after the 2nd "shared" user dialog?

I have included my dialog script below. The if statement is down by the wizard loop at the present time. I have tried moving this right below the 2nd dialog labeled Shared but that wouldn't work. Any ideas on the correct placement of the if statement?


[ User Interface ]
! Wizard dialog definition(s)
Define Wizard Dialog "#1" (Welcome)
Define Wizard Dialog "SHARED" (Select Install Folder) (%DATAPATH%)
Define Wizard Dialog "INSTALL" (Select Install Folder) (%_SB_INSTALLDIR%)
Define Wizard Dialog "#4" (Ready to Install)

! The Wizard Loop displays the dialog screens that the user sees in the installation
Loop Wizard (Abort Dialog Active)
If %DATAPATH%\AAS2.EXE File or Folder doesn't exist Then
Display Message Box "The file or folder chosen is the incorrect FPA sha..." -- "Incorrect Shared Folder"
End
End

Thanks,

Brandon