Jump to content

Recommended Posts

Posted

I have the problem that if i cancel my script at the inputbox it still says that i have entred a wrong name.....this should normally only happen if i really entred a wrong name....

$name = InputBox("CD Drive", "Insert the name of your drive here:","E"," M1")

$count = 0

If Not @error Then

Do

CDTray(& $name":","open")

CDTray(& $name":","close")

$count = $count + 1

Until $count = 10

EndIf

MsgBox("","Error", "You typed in a wrong name")

Posted

I have the problem that if i cancel my script at the inputbox it still says that i have entred a wrong name.....this should normally only happen if i really entred a wrong name....

You have only considered that the vlue of @error is not 0, you need to check if it was 1 for examle which means Cancel was pressed.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Posted

This worked for me i made several small changes, make note of them:

$name = InputBox("CD Drive", "Insert the name of your drive here:","E"," M1")
$count = 0
If Not @error Then
    If DriveGetType($Name&":\")<> "CDROM" then 
        MsgBox("","Error", "The drive you specified does not exist, or is not a CDROM.")
        Exit
    Else
        Do
            $Test = CDTray($name&":","open")
            $Test1 = CDTray($name&":","closed")
            $count = $count + 1
        Until $count = 10
    EndIf
Else
    MsgBox(0,"Error", "Input error occured"&@CRLF&"Error Code: "&@error) 
EndIf
:)

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
×
×
  • Create New...