Sign in to follow this  
Followers 0
ZOTHOP

Drive control before close computer

3 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

_____________________________________________________________________________

Share this post


Link to post
Share on other sites

Thank you !

Share this post


Link to post
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
Sign in to follow this  
Followers 0