Jump to content

Desk Drive


BLuFeNiX
 Share

Recommended Posts

Desk Drive v1.0

Straight from the support forum! :)

if you have a floppy drive you may get VERY VERY annoyed...

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.11.12 (beta)
Author:      BLuFeNiX (formerly known as HackerZer0)

Script Function:
    Add shortcut to removable media to desktop.

#ce ----------------------------------------------------------------------------

Opt("OnExitFunc", "_CLEANUP")

While 1
    
    For $i = 65 to 90
        If DriveStatus (Chr($i) & ":") = "READY" then
        
            If DriveGetType(Chr($i) & ":") = "Fixed" then Continueloop
        
            If NOT FileExists(@desktopDir & "\Drive (" & Chr($i) & ").lnk") then FileCreateShortcut(Chr($i) & ":",@DesktopDir & "\Drive (" & Chr($i) & ").lnk")
        
            Else
                FileDelete(@desktopDir & "\Drive (" & Chr($i) & ").lnk")
        EndIf
    Next
    
    Sleep(1000)
WEnd

Func _CLEANUP()
    FileDelete(@desktopDir & "\Drive (*).lnk")
EndFunc
Link to comment
Share on other sites

You could do it e.g. this way: (If a floppy exists, the Shortcut is always created, even, if no Disk is inserted)

#cs ----------------------------------------------------------------------------

AutoIt Version: 3.2.11.12 (beta)
Author:      BLuFeNiX (formerly known as HackerZer0)

Script Function:
    Add shortcut to removable media to desktop.

#ce ----------------------------------------------------------------------------

Opt("OnExitFunc", "_CLEANUP")
If DriveStatus ("A:") <> "INVALID" Then FileCreateShortcut("A:",@DesktopDir & "\Drive (A).lnk"); Floppy A
If DriveStatus ("B:") <> "INVALID" Then FileCreateShortcut("B:",@DesktopDir & "\Drive (B).lnk"); Floppy B
While 1
    
    For $i = 67 to 90
        If DriveStatus (Chr($i) & ":") = "READY" then
        
            If DriveGetType(Chr($i) & ":") = "Fixed" then Continueloop
        
            If NOT FileExists(@desktopDir & "\Drive (" & Chr($i) & ").lnk") then FileCreateShortcut(Chr($i) & ":",@DesktopDir & "\Drive (" & Chr($i) & ").lnk")
        
            Else
                FileDelete(@desktopDir & "\Drive (" & Chr($i) & ").lnk")
        EndIf
    Next
    
    Sleep(1000)
WEnd

Func _CLEANUP()
    FileDelete(@desktopDir & "\Drive (*).lnk")
EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

opt("TrayMenuMode",1)
HotKeySet("{ESCAPE}", "ESCAPE")
While 1
    For $i = 67 to 90
        If DriveStatus (Chr($i) & ":") = "READY" then
        If DriveGetType(Chr($i) & ":") = "Fixed" then Continueloop
        If NOT FileExists(@desktopDir & "\Drive (" & Chr($i) & ").lnk") then fileCreateShortcut(Chr($i) & ":",@DesktopDir & "\Drive (" & Chr($i) & ").lnk")
        if FileExists(@desktopDir & "\Drive*.lnk") then TraySetState (4)
        Else
        FileDelete(@desktopDir & "\Drive (" & Chr($i) & ").lnk")
        if NOT FileExists(@desktopDir & "\Drive*.lnk") then TraySetState (8)    
        EndIf
    Next    
Sleep(500)
WEnd
func escape()
FileDelete(@desktopDir & "\Drive (*).lnk")  
Exit
EndFunc

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