Jump to content

Search the Community

Showing results for tags 'volume label changer'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Hi, just posting an example on how to change a drive label, it lists labels and drive type, you just insert the drive letter and the label you want and press change. #region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=Resources\Terminal.ico #AutoIt3Wrapper_Res_Icon_Add=Resources\Terminal.ico #AutoIt3Wrapper_Run_Tidy=n #endregion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <GuiListView.au3> Opt("GUIOnEventMode", 1) Local $Change, $List, $Label, $Drive, $sType, $aArray, $sLabel, $Input1, $Input2, $Volume, $Letter, $LabelChange, $cListView, $iFreeSpace $Form1 = GUICreate("Volume Label Changer", 425, 370, 190, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") $cListView = GUICtrlCreateListView("Drive Letter|Label|Type|Free Space", 8, 64, 410, 300) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 100) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 100) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 100) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 3, 100) $Exit = GUICtrlCreateButton("Exit", 184, 34, 75, 25) GUICtrlSetOnEvent($Exit, "Close") $Change = GUICtrlCreateButton("Change to", 96, 34, 75, 25) GUICtrlSetOnEvent($Change, "Change") $List = GUICtrlCreateButton("List Drives", 8, 34, 75, 25) GUICtrlSetOnEvent($List, "List") $Label1 = GUICtrlCreateLabel("Volume to change", 8, 8, 91, 17) $Label2 = GUICtrlCreateLabel("Set to:", 176, 8, 35, 17) $Input1 = GUICtrlCreateInput("", 104, 8, 57, 21) $Input2 = GUICtrlCreateInput("", 216, 8, 57, 21) GUISetState(@SW_SHOW) Func List() _GUICtrlListView_DeleteAllItems($clistview) ;GUICtrlCreateListViewItem("=====|=====|=====|=====", $clistview) $aArray = DriveGetDrive('ALL') If @error Then MsgBox(4096, "DriveGetDrive", "It appears an error occurred.") Else For $i = 1 To $aArray[0] $sLabel = DriveGetLabel($aArray[$i] & "\") If @error = 1 Then $sLabel = "<NO LABEL>" EndIf $sType = DriveGetType($aArray[$i] & "\") If @error = 1 Then $sType = "<NO TYPE>" EndIf $iFreeSpace = DriveSpaceFree($aArray[$i] & "\") StringUpper($sLabel) GUICtrlCreateListViewItem(StringUpper($aArray[$i])&'|'&$sLabel&'|'&$sType&'|'&$iFreeSpace, $cListView) Next EndIf EndFunc ;==>List Func Change() $Volume = GUICtrlRead($Input1) $Volume = StringUpper($Volume & ':') $Letter = GUICtrlRead($Input2) $Letter = StringUpper($Letter) $sType = DriveGetType($Volume) If $sType = ('CDROM') Then MsgBox(4096, 'Volume Info', "Drive type is CDROM can't change these.") Else $LabelChange = DriveSetLabel($Volume, $Letter) If $LabelChange = 0 Then MsgBox(4096, "Volume Info", "Failure changing label, Wrong letter or too many characters." & @CRLF & "Letter and Label entered: " & $Volume & ' + ' & $Letter) ;Else ;MsgBox(4096, "Volume Info", "Set Drive Label on " & $Volume & " To: " & $Letter) EndIf EndIf List() EndFunc ;==>Change Func Close() Exit EndFunc ;==>Close Do Sleep(100) Until $Form1 = 0 EDIT: removed GUIGetMsg, as GUIOnEventMode was set to 1, rendering the first useless. UPDATE: MsgBoxes are now only used for errors, listbox added to display multiple drive informations, check caps. Volume Label Changer.au3
×
×
  • Create New...