Jump to content

Search the Community

Showing results for tags 'Drive'.



More search options

  • 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


Location


WWW


Interests

Found 7 results

  1. Well Another Function. For Get de Drive letter marked as write enabled. Global Const $sCLSID_CDBurn = "{fbeb8a05-beee-4442-804e-409d6c4515e9}" Global Const $sIID_ICDBurn = "{3d73a659-e5d0-4d42-afc0-5121ba425c8d}" Global Const $sTagCDBurn = "GetRecorderDriveLetter hresult(wstr;uint); Burn hresult(hwnd); HasRecordableDrive hresult(bool*)" MsgBox(0, "", _GetRecorderDriveLetter()) Func _GetRecorderDriveLetter() Local $sDriveLetter = "" Local $HasRecordableDrive = False Local $oCDBurn = ObjCreateInterface($sCLSID_CDBurn, $sIID_ICDBurn, $sTagCDBurn) If Not IsObj($oCDBurn) Then Return $sDriveLetter If SUCCEEDED($oCDBurn.HasRecordableDrive($HasRecordableDrive)) Then $oCDBurn.GetRecorderDriveLetter($sDriveLetter, 4) EndIf Return $sDriveLetter EndFunc ;==>_GetRecorderDriveLetter Func SUCCEEDED($hr) Return ($hr >= 0) EndFunc ;==>SUCCEEDED
  2. Hi Forum, I am just a beginner in AUTOIT, Just wanted to know, Is it possible to download a folder from my Google Drive automatically using AUTOIT, I googled to see some logic or guide to complete my task, but haven't succeded, Please guide me Thanks in Advance Sathish V.
  3. #include-once ; #UDF# ======================================================================================================================= ; Title .........: PathSplitEx ; AutoIt Version : 3.3.8.1 ; Language ......: English ; Description ...: Splits a path into the drive, directory, file name and file extension parts ; Author(s) .....: DXRW4E ; Notes .........: ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ; _PathSplitEx ; _PathSplitParentDir ; _FileExistsEx ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _PathSplitEx ; Description ...: Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing. ; Syntax.........: _PathSplitEx($sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sFileName, ByRef $sExtension) ; Parameters ....: $sFilePath - The path to be split (Can contain a UNC server or drive letter) ; $sDrive - String to hold the drive ; $sDir - String to hold the directory ; $sFileName - String to hold the file name ; $sExtension - String to hold the file extension ; Return values .: Success - Returns an array with 5 elements where 0 = original path 1 = drive, 2 = directory, 3 = filename, 4 = extension ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: This function does not take a command line string. It works on paths, not paths with arguments. ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _PathSplitEx($sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sFileName, ByRef $sExtension) $sFilePath = StringRegExp($sFilePath, "^((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*[\/\\])?((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", 1) $sDrive = $sFilePath[1] $sDir = StringRegExpReplace($sFilePath[2], "[\/\\]+\h*", "\" & StringLeft($sFilePath[2], 1)) $sFileName = $sFilePath[3] $sExtension = $sFilePath[4] Return $sFilePath EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _PathSplitParentDir ; Description ...: Splits a path into the drive, directory, file name and file extension parts. An empty string is set if a part is missing. ; Syntax.........: _PathSplit($sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sParentDir, ByRef $sFileName, ByRef $sExtension) ; Parameters ....: $sFilePath - The path to be split (Can contain a UNC server or drive letter) ; $sDrive - String to hold the drive ; $sDir - String to hold the directory ; $sParentDir - String to hold the parent directory ; $sFileName - String to hold the file name ; $sExtension - String to hold the file extension ; Return values .: Success - Returns an array with 6 elements where 0 = original path 1 = drive, 2 = directory, 3 = parentdir, 4 = filename, 5 = extension ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: This function does not take a command line string. It works on paths, not paths with arguments. ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _PathSplitParentDir($sFilePath, ByRef $sDrive, ByRef $sDir, ByRef $sParentDir, ByRef $sFileName, ByRef $sExtension) $sFilePath = StringRegExp($sFilePath & " ", "^((?:\\\\\?\\)*(\\\\[^\?\/\\]+|[A-Za-z]:)?(.*?[\/\\]+)?([^\/\\]*[\/\\])?[\/\\]*((?:[^\.\/\\]|(?(?=\.[^\/\\]*\.)\.))*)?([^\/\\]*))$", 1) $sDrive = $sFilePath[1] $sFilePath[2] = StringRegExpReplace($sFilePath[2], "[\/\\]+\h*", "\" & StringLeft($sFilePath[2], 1)) $sDir = $sFilePath[2] $sParentDir = $sFilePath[3] $sFileName = $sFilePath[4] $sExtension = $sFilePath[5] Return $sFilePath EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileExistsEx ; Description ...: Get New Files Name ; Syntax.........: _FileExistsEx(ByRef $sFilePath[, $iFileExists]) ; Parameters ....: $sFilePath - The Fullpath file ; $iFileExists - Optional ; Author ........: DXRW4E ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _FileExistsEx(ByRef $sFilePath, $iFileExists = 0) While FileExists($sFilePath) $iFileExists += 1 $sFilePath = StringRegExpReplace($sFilePath & " ", "( - \(\d+\))?(\.[^\.\\]*)?(\h)$", " - (" & $iFileExists & ")$2") WEnd EndFunc _PathSplitEx.au3
  4. Hi, i have been stuck for a while now, and i can't seem to get it done. I have tried google and this forum but i can not find the answer i need. I am creating a installer, using autoit for deploying Windows Server 2008 with the option to a custom boot partion size. Right now i have pre determined the sizes that you can choose from, the only problem i have is that, the list has sizes in it that are bigger that the drive size. So what i want to create is a script that reads the drive size and makes a combolist starting from 40GB and then in steps of 10GB till it reaches the max size of the drive. I have attached the script i use. Hope anyone can help me sincerly, Mark Wingens Preload2.au3
  5. I'm running Windows 7. I have an autorun.inf file on a removable drive that looks like this: [autorun] label=My Drive Label When I plug in that USB drive and open Windows Explorer, I see that drive properly labeled. It says "My Drive Label (G:)" next to the drive icon. However, I can't figure out how to read that label (without reading the ini file, of course). If I use DriveGetLabel("G:"), it returns the string that is stored when you right-click the drive and select properties and type in a label. I can't figure out how to make it return the label that is displayed in Windows Explorer. Any ideas?
  6. _FileFindEx Get More from File/Folder Searches (formerly _WinAPI_FileFind) Since it's always bugged me that the AutoIT implementation of 'FindFirstFile' and 'FindNextFile' only returned filenames and that extra calls had to be made to get file-size, attributes, short-names, and date/time of file creation,last-access, & last-modification which severely increased the amount of time it took to properly analyze the contents of a folder and it's files, I decided to create an alternative. This uses the same Windows calls as AutoIT, except it returns all the information that it rightfully should for each file found - including: File attributes (in numerical form, not a silly string format)Creation TimeLast-Access TimeLast-Write TimeFileSizeFilename (obviously)8.3 short name (if it is 1. different from the regular Filename and 2. if short-names haven't been turned offReparse Point info (if available)Now, the calling process is a little different, though for the most part not much is required to be altered in existing code. Basically, the attributes-check for folders is a numerical test, and when a folder is found, you *need* to test for '.' and '..' navigation (fake) folders. Also, the 'While' loop changes into a 'Do-Until' loop. Additionally, the first _FileFindExFirstFile() call returns a file, whereas FileFindFirstFile() doesn't (which never made sense to me). To convert times into a readable format, you'll need to pass the array to the _FileFindExTimeConvert() function. Optionally, you can get the _WinTimeFunctions UDF and call those functions using array index constants: $FFX_CREATION_TIME, $FFX_LAST_ACCESS_TIME, or $FFX_LAST_MODIFIED_TIME. Note all _FileFindEx* calls are done using a special array, though 'ByRef' for quicker performance. A nice application I found for this UDF was comparing files/folders - which is pretty easy using 64-bit filetime and file-size comparisons (no need for time conversion there). The ZIP includes 4 files: the _FileFindEx UDF, FileFindExTest, the license agreement (same as below), and _LinkedOutputDisplay. Please note that _LinkedOutputDisplay on its own is a mess - but its included as-is to help see a side-by-side comparison of the output from FileFindExTest. To get all the same information that _FileFindEx provides, the AutoIt functions below would need to be called: FileFindFirst/NextFileFileGetAttrib *** NOTE: This Fails to report on some attributes (Reparse Points, Sparse Files) ***FileGetTime *3 (one for each time - Creation, Last-Access, Last-Modified)FileGetSizeFileGetShortName (note: this provides a full path, rather than just a file name)Please note that for a fair time comparison, a clean boot is needed for each test due to O/S buffering after a scan. Between boots, the order of function calls in 'FileFindExTest' would need to be swapped. In first-run tests, _FileFindEx has consistently been quicker when gathering more than basic filename info. However, running the UDF in 64-bit mode on Vista+ O/S's results in slower performance, hence this note: *IMPORTANT* - Speed is severely affected on certain processors when the script is run in x64 mode. I therefore recommend running/compiling the code in both bit-modes beforehand to see what the speed difference is. On my machine I've found x86 is much faster, whereas x64 is much slower than AutoIt's search functions. Other's have so I'm guessing it must be how optimized the hardware architecture is at running x64 code. Update Log: Download the ZIP Here Ascend4nt's AutoIT Code License agreement: While I provide this source code freely, if you do use the code in your projects, all I ask is that: If you provide source, keep the header as I have put it, OR, if you expand it, then at least acknowledge me as the original author, and any other authors I creditIf the program is released, acknowledge me in your credits (it doesn't have to state which functions came from me, though again if the source is provided - see #1)The source on it's own (as opposed to part of a project) can not be posted unless a link to the page(s) where the code were retrieved from is provided and a message stating that the latest updates will be available on the page(s) linked to.Pieces of the code can however be discussed on the threads where Ascend4nt has posted the code without worrying about further linking.
  7. For those of us with more than one hard drive, and with power management options enabled for disks, you might find yourself in the same situation as I've been in - asking the question 'Is that drive really powered down?'. I coded up the below example to get that information to you. Note that it reads power states for ALL drives, and the status information for removable & virtual drives will either show up as 'Unknown' or Powered-On. As a courtesy, please be sure to credit me or keep the UDF header intact if you use the code ; =============================================================================================================================== ; <DrivesPowerStatus.au3> ; ; Reports the Power status for all drives. ; ; Functions: ; _DriveGetPowerState() ; Returns a boolean indicating drive status (True=active, False=low power or powered-off) ; ; Author: Ascend4nt ; =============================================================================================================================== #include <Array.au3> Local $aDrives,$aDevInfo $aDrives=DriveGetDrive("ALL") ; returns array of 'drive:' with lower-case letters If @error Then Exit ; Create 2D array - 2nd column will carry the Power State info, 3rd Drive Type Dim $aDriveStates[$aDrives[0]+1][3] ; Copy over drives and get Power States For $i=1 To $aDrives[0] $aDriveStates[$i][0]=StringUpper($aDrives[$i]) $aDriveStates[$i][1]=_DriveGetPowerState($aDrives[$i]) If @error Then $aDriveStates[$i][1]="Unknown" $aDriveStates[$i][2]=DriveGetType($aDrives[$i]) Next $aDriveStates[0][0]="Drive" $aDriveStates[0][1]="Active Power State?" $aDriveStates[0][2]="Drive Type" _ArrayDisplay($aDriveStates,"Drives Power Status") ; =================================================================================================================== ; Func _DriveGetPowerState($sDrive) ; ; Returns a boolean representing the active power state of the given drive. ; True = Active (powered on, active), False = Inactive (either powered off, or in a low power state) ; ; $sDrive = Drive letter, or full path (only the Drive letter is extracted from the string) ; ; Returns: ; Success: True/False ; Failure: -1, with @error set: ; @error = 1 = invalid parameter ; @error = 2 = DLLCall error. @extended contains DLLCall error code (see AutoIt Help) ; @error = 3 = API call error. Call 'GetLastError' for more info ; ; Author: Ascend4nt ; =================================================================================================================== Func _DriveGetPowerState($sDrive) $sDrive=StringLeft($sDrive,1) If StringIsAlpha($sDrive)=0 Then Return SetError(1,0,-1) ; Device path for logical drives: '\\.\C:' Local $iErr,$aRet,$hDisk,$sDevicePath='\\.\'&$sDrive&':' #cs ; API call params: [0 Access (for metadata & device info),3 ShareMode for 'Read'+'Write', ; 0 (NULL) SecurityAttribs (i.e. none),3 CreationDisposition for 'OpenExisting',0 Flags,0 (NULL) TemplateFile] ; *We could also use _WinAPI_CreateFile($sDevicePath,2,8,6), but there's no guarantee that '8' as the 3rd param ; will continue to work (its currently a sort of 'hack' to work around the limitations of the UDF [to force AccessMode to 0]) #ce $aRet=DllCall('kernel32.dll','handle','CreateFileW','wstr',$sDevicePath,'dword',0,'dword',3,'ptr',0,'dword',3,'dword',0,'ptr',0) If @error Then Return SetError(2,@error,-1) If $aRet[0]=-1 Then Return SetError(3,0,-1) $hDisk=$aRet[0] ;~ ConsoleWrite("Handle for Drive '"&$sDrive&":' = "&$hDisk&@CRLF) $aRet=DllCall('kernel32.dll','bool','GetDevicePowerState','handle',$hDisk,'bool*',0) $iErr=@error ; We don't worry about whether this is successful, since there's nothing we can do about it: DllCall('kernel32.dll','bool','CloseHandle','handle',$hDisk) ; Error with GetDevicePowerState call? If $iErr Then Return SetError(2,$iErr,-1) If Not $aRet[0] Then Return SetError(3,0,-1) ;~ ConsoleWrite("$aRet[2]="&$aRet[2]&@CRLF) Return ($aRet[2]<>0) EndFunc
×
×
  • Create New...