Jump to content

.....


 Share

Recommended Posts

2, i think you can identify a floppy by its small space (1.44 MB)

$drive=DriveGetDrive("REMOVABLE")
$space = DriveSpaceTotal( $drive)

if $space< 2 then
;anything here
endif

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

I might be over simplifying this... But 99.9% of floppy drives out there with be assigned to A:\... and 99.9% of A:\ drives will be floppy drives...

So... if DriveGetType("A:") returns anything... then ya have a floppy drive... if it returns nothing... then ya don't have a floppy drive...

JayMan

Link to comment
Share on other sites

But i still think DriveGetDrive=("Floppy") would be a great idea if it existed :)

Drive letters A: & B: are reserved for floppy drives. You may be able to code for those 2 drives and ensure that they are in a ready state.

;)

Link to comment
Share on other sites

This works for me, it's quite crude really...

#include<string.au3>
For $i = 65 to 90
    $key = Regread("HKLM\System\MountedDevices","\DosDevices\" &  Chr($i) & ":")
    If StringInStr(_HexToString(StringReplace ($key, "00", "")),"Floppy") and DriveStatus( Chr($i) & ":\" ) <> "INVALID" Then Msgbox(0,"",Chr($i) & ": is a floppy drive")
Next

Edit: Variation on a theme!

$var = DriveGetDrive ( "ALL" )
If NOT @error Then
    For $i = 1 to $var[0]
        $key = Regread("HKLM\System\MountedDevices","\DosDevices\" &  $var[$i])
        If StringInStr(_HexToString(StringReplace ($key, "00", "")),"Floppy") Then Msgbox(0,"",$var[$i] & " is a floppy drive")
    Next
EndIf
Edited by ChrisL
Link to comment
Share on other sites

A combination of the 2

While 1
    $var = DriveGetDrive ( "ALL" )
    If NOT @error Then
        For $i = 1 to $var[0]
            $key = Regread("HKLM\System\MountedDevices","\DosDevices\" &  $var[$i])
            If StringInStr(_HexToString(StringReplace ($key, "00", "")),"Floppy") and DriveGetFileSystem( $var[$i]) <> "" Then Exit Msgbox(0,"",$var[$i] & " is a loaded floppy drive")
        Next
            Sleep(250)
    EndIf
WEnd

On my laptop it doesn't make the sound until a floppy is inserted ( and only the fist time ) but with this being a USB external I think the disk notification is handled by the drive. I'm not sure if that will be the case on a standard internal one

Link to comment
Share on other sites

Your script exits after determining if a floppy exists or is plugged in? It doesn't continue looping after that?

Maybe that's why the sound came on once only?

What about the DriveGetFileSystem example i gave?

I think I have to rush over to my friend's place tomorrow if all fails ;) ...he has an internal floppy drive

No it's not that, if I run the script again after taking the floppy out it doesn't make the sound again.. I'm not that stupid!

I just wrote that in as a way of exiting, it's only an example. :)

The sound only happened once full stop so no it didn't do it with yours either but like I said that maybe because its an external USB

Edited by ChrisL
Link to comment
Share on other sites

yes when I change the path to A: it did... however

I've just been upstairs and fired up my tower and the function DriveGetFileSystem makes the floppy grind but like I said I don't think internals handle the notification they actually have to check

It is only a very quick grind but I guess it depends how frequently you are going to poll

Link to comment
Share on other sites

$dList = DriveGetDrive("Removable")
For $I = 1 To Ubound($dList) -1
   If _DriveIsFloppy($dList[$I]) = 1 Then MsgBox(0, "Test", "Drive " & StringUpper($dList[$I]) & " is a floppy drive.")
Next

Func _DriveIsFloppy($Drive, $Computer = ".")
$Drive = StringReplace($Drive, "\", "")
Local $colItems = ""
$objWMIService = ObjGet("winmgmts:\\" & $Computer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk WHERE MediaType = '5'", "WQL", 0x30)
If IsObj($colItems) then
   For $objItem In $colItems
      If $objItem.DeviceID = $Drive Then
         Return 1
      Else
         Return 0
      EndIf
   Next
Endif
EndFunc

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Does checking drive A: 's total space produce grinding noises(attempt to access) from the drive?

I think everyything that wants anything from Drive A: is going to do it becuase unless it's like my USB drive it lust has to keep physicaly spinning up the disk to check

Edit: I was going to change lust to just but I don't think I will! :)

Edited by ChrisL
Link to comment
Share on other sites

If you only need to know it's a floppy drive then use this.

$var = DriveGetDrive ( "ALL" )
If NOT @error Then
    For $i = 1 to $var[0]
        $key = Regread("HKLM\System\MountedDevices","\DosDevices\" &  $var[$i])
        If StringInStr(_HexToString(StringReplace ($key, "00", "")),"Floppy") Then Msgbox(0,"",$var[$i] & " is a floppy drive")
    Next
EndIf

If you need to know a floppy disk is loaded I think your knackered!

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