Jump to content

Drive control before close computer


Recommended Posts

Here is my script

$var = DriveStatus( "e:\" )
If $var="READY" then 
Diskoqp()
Else
ordishut()
EndIf
Func Diskoqp()
CDTray("e:","open")
MsgBox(4096,"Careful !","Please remove CD/DVD and retry")
EndFunc
Func ordishut()
Shutdown(1)
EndFunc

I put a shortcut of my program on Windows Desktop.

This code control the CD/DVD drive e:. If there is CD or DVD a message box appear and the drive open, else the computer shutdown

I am a novice and I have problems to control USB ports to know if there are drives connect in.

Edited by ZOTHOP
Link to comment
Share on other sites

If _RemoveMediaDetect() Then
    MsgBox(0, "", "Removable storage detected")
EndIf

Func _RemoveMediaDetect()
    $drive = DriveGetDrive("REMOVABLE")
    If $drive[0] > 0 And $drive[1] <> "a:" Then
        Return True
    Else
        Return False
    EndIf
EndFunc

..<> "a:" - for ignoring floppy

Edited by Godless

_____________________________________________________________________________

Link to comment
Share on other sites

  • 3 weeks later...

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...