Jump to content

Prompt to overwrite folder


Recommended Posts

I have put this script together, but I am trying to figure out what the most effective way would be to have it prompt the user if they are about to overwrite an existing file with one they are about to create. I have fumbled around with "If Then" with no avail, I am definately missing something. I have taken all all of my disfunctional code out, and left just what works. Thanks in advance for looking at this, I am stumped. Of course, that's not saying much because I am no coder, I am a PC hardware and network guy.

Global $Patient_Last_Name

Global $Patient_First_Name

Global $Patient_Middle_Inital

Global $Patient_YOB

Global $Patient_MOB

Global $Patient_DOB

_first()

_second()

DirCopy ("C:\Documents and Settings\eric\My Documents\AIT\Template","C:\Documents and Settings\eric\My Documents\AIT\" & $Patient_Last_Name & ", " & $Patient_First_Name & " " & $Patient_YOB & "-" & $Patient_MOB & "-" & $Patient_DOB)

Func _first()

$Patient_Last_Name = InputBox("Please enter", "Patient Last Name")

If $Patient_Last_Name = "" And @error = 1 Then Exit

$Patient_First_Name = InputBox("Please enter", "Patient First Name")

If $Patient_First_Name = "" And @error = 1 Then Exit

$Patient_Middle_Initial = InputBox("Please enter", "Patient Middle Initial")

If $Patient_Middle_Initial = "" And @error = 1 Then Exit

$msg = MsgBox (4, "Is the Patient's name correct?", $Patient_Last_Name & ", " & $Patient_First_Name & "," & $Patient_Middle_Initial)

if $msg = 7 Then _first()

If $msg = "" And @error = 1 Then Exit

EndFunc

Func _second()

$Patient_YOB = InputBox("Please enter", "Patient Year of Birth: 4-Digit")

If $Patient_YOB = "" And @error = 1 Then Exit

$Patient_MOB = InputBox("Please enter", "Patient Month of Birth: 2-Digit")

If $Patient_MOB = "" And @error = 1 Then Exit

$Patient_DOB = InputBox("Please enter", "Patient Day of Birth: 2-Digit")

If $Patient_DOB = "" And @error = 1 Then Exit

$msg=MsgBox (4, "Is the Patient's DOB correct?", $Patient_YOB & "-" & $Patient_MOB & "-" & $Patient_DOB)

if $msg = 7 Then _second()

If $msg = "" And @error = 1 Then Exit

EndFunc

Link to comment
Share on other sites

I didn't look at your code but this should give you a general idea:

$pass = 0
If FileExists(@MyDocumentsDir & '\My Pictures\Something') then;If the folder exists
    $pass = Msgbox(4, 'Warning', 'Are you sure you want to overwrite the folder called "Something"?')
EndIf 
If $pass <> 4 then;If the user clicked yes or if the folder doesn't exist
    DirRemove(@MyDocumentsDir & '\My Pictures\Something')
    DirCreate(@MyDocumentsDir & '\My Pictures\Something')
EndIf
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
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...