Jump to content

Little problem with @error


Recommended Posts

Hello,

I include my little code to help understand my situation:

;Open up EdLaptop to Y

DriveMapAdd ("Y:", "\\EdLaptop\EdLaptop")

Select

Case @error=""

SoundPlay ("C:\Windows\Media\chimes.wav")

Case @error>0

SoundPlay ("C:\Windows\Media\chord.wav")

MsgBox (309, "Error", "Failure to connect Network Drive.", "")

EndSelect

;WinClose ("title", "")

SoundPlay ("C:\Windows\Media\chimes.wav")

I tried If Then statements as well, but I cannot seem to get the chimes.wav to play when teh DriveMapAdd is successful. However, if an error occurs, the chord.wav plays just fine.

Any ideas?

Thanks,

edsager

:(

Link to comment
Share on other sites

Try.

DriveMapAdd ("Y:", "\\EdLaptop\EdLaptop")

If NOT @error Then
   SoundPlay ("C:\Windows\Media\chimes.wav")
Else
   SoundPlay ("C:\Windows\Media\chord.wav")
   MsgBox (309, "Error", "Failure to connect Network Drive.")
EndIf

SoundPlay ("C:\Windows\Media\chimes.wav"); Need This line?
Edited by Burrup

qq

Link to comment
Share on other sites

Try.

DriveMapAdd ("Y:", "\\EdLaptop\EdLaptop")

If NOT @error Then
   SoundPlay ("C:\Windows\Media\chimes.wav")
Else
   SoundPlay ("C:\Windows\Media\chord.wav")
   MsgBox (309, "Error", "Failure to connect Network Drive.")
EndIf

SoundPlay ("C:\Windows\Media\chimes.wav"); Need This line?

<{POST_SNAPBACK}>

Thank you.

I tried that and it still will not play the chimes.wav when successful, and it still plays the chord.wav when unsuccessful.

Also, as per your suggestion, I got rid of the last SoundPlay.

I am a bit at a loss and corn-fused as to why it will not work. The .wav files are exactly where they should be on the hard drive.

Again, thank you,

edsager

:(

Link to comment
Share on other sites

try this....

$map = DriveMapAdd ("Y:", "\\EdLaptop\EdLaptop")
       Select
           Case $map = 1 OR ($map <> 0 AND @error == 0)
SoundPlay ("C:\Windows\Media\chimes.wav")
           Case @error = 1 
SoundPlay ("C:\Windows\Media\chord.wav")
   MsgBox (309, "Error", "Undefined / Other error")
            Case @error = 2
SoundPlay ("C:\Windows\Media\chord.wav")
   MsgBox (309, "Error", "Access to the remote share was denied")
            Case @error = 3
SoundPlay ("C:\Windows\Media\chord.wav")
   MsgBox (309, "Error", "The device is already assigned")
             Case @error = 4
SoundPlay ("C:\Windows\Media\chord.wav")
   MsgBox (309, "Error", "Invalid device name")
              Case @error = 5
SoundPlay ("C:\Windows\Media\chord.wav")
   MsgBox (309, "Error", "Invalid remote share")
               Case @error = 6
SoundPlay ("C:\Windows\Media\chord.wav")
   MsgBox (309, "Error", "Invalid password")

EndSelect

Edited by quaizywabbit
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
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...