Sign in to follow this  
Followers 0
chelseafc

Removable drive check

9 posts in this topic

Hello, i m trying to make a script for my school because alot of people are losing their removable drive because of forgeting to remove their drives.

So i came up with a solution so that when a removable drive is still plugged in, a dialog with a 300x200 image will come up to warn the user and stop the shut down, log off or restart. they will have to close the dialog (possibly make them click the image=create a image button? : , i will write "click here to close" on the image)and eject the removable drive to preform restart, shutdown or log off.

unfortunally, i m still a starter and i m seeking help. I actually have an exisiting script related to it so you might want to take a look. I m also looking to make it run at startup :( and i hope someone will help me do that.

this one is made from a nice person in this forum, it detects if you have a removable drive in 3 minsutes. If true, a traytip will pop up. This not not quite useful since its not annoying! :(

Local $d

Local Const $min = 3

While 1

  $d = DriveGetDrive( "REMOVABLE" )

  If not @error Then

      TrayTip('Removable Disk Detected', 'Remember to unplug it soon or later...', 10, 2)

  EndIf

 

  Sleep($min * 60 * 1000)

WEnd

this one is a intro fade in 300x200 gui box. It has no minimizem maxinize, close buttons. i m trying to make this the reminder.

#include <GUIConstants.au3>

$splash = GUICreate("Loading...",300, 200, -1, -1, $ws_popup)

GuiCtrlCreatePic("splash.bmp", 0, 0, 300, 200)

For $trans = 0 To 255

    WinSetTrans($splash, "", $trans)

    Sleep(3)

    GUISetState()

Next

Sleep(3000)

GUIDelete($splash)

Share this post


Link to post
Share on other sites



This is a good idea. The little drives themselves ought to be able to initiate a beep every x minutes, or after a certain period of inactivity of the drive.

If you could get an executable onto the drive itself which would auto-start when the drive hooks up, that would be cool, but security measures on the local machine might prohibit that.

J


If I am too verbose, just say so. You don't need to run on and on.

Share this post


Link to post
Share on other sites

dunno if this should be in the ideas section, but if someone can make something like that it would be cool!

Share this post


Link to post
Share on other sites

hello,

Try this code :

while 1
    sleep(500)
    if winactive("Arrêt de Windows","")=1 then  detect(); the title of the last window which allow to restart, shutdown ... (french in my case)
WEnd

func detect()
    
    
    $alarme=0
    $listsupport=""
    $tab_cd=DriveGetDrive ( "CDROM" ); list all cd rom drives
    If @error<>1 Then
        For $cpt=1 To $tab_cd[0]; test the status for each drive
            $status= DriveStatus($tab_cd[$cpt])
            If $status="READY" Then 
                $alarme=1
                $listsupport=$listsupport&$tab_cd[$cpt]&@CRLF; store the drive where the CD is present
            EndIf
        Next
    EndIf
    $tab_remov=DriveGetDrive ( "REMOVABLE" ); list all removable devices
    If @error<>1 Then
        For $cpt=1 To $tab_remov[0]
            $status=DriveStatus($tab_remov[$cpt])
            If $status="READY" Then 
                $alarme=1
                $listsupport=$listsupport&$tab_remov[$cpt]&@CRLF; store the drive where the device is present
            EndIf
        Next
    EndIf
    if $alarme=1 Then 
        runwait(@comspec&" /c "&chr(7))
        SplashImageOn("Warning !","d:\diablo.jpg",1024,768); display a picture
        sleep(1000)
        SplashOff()
        MsgBox(16,"Support(s) oublié(s) !!","Attention au moins support a été oublié:"&@CRLF&$listsupport); list all media forgotten 
EndIf
    
EndFunc

If you want to run it for each user, make a link in C:\Documents and Settings\All Users\Start Menu\Programs\start (warning I have tried to translate this path and I don't speek english good...)

I hope it'll help you


Share this post


Link to post
Share on other sites

i tried, it didn't work on my computer. I thinl The script looks fine thought.

Share this post


Link to post
Share on other sites

Have you replaced

Arrêt de Windows

by the title of your window ?


Share this post


Link to post
Share on other sites

sorry i m a computer noob here, do you mean the name of the exe compiled file of your script or something else?

Share this post


Link to post
Share on other sites

I'm using the title of the logoff windows. cf picture

It seems to me that for english OS, it's "Shut Down Windows"


Share this post


Link to post
Share on other sites

ok, cause i dont think it will work on xp. Thanks

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