Synapse Posted January 7, 2008 Posted January 7, 2008 Howdy...i`ve created this UDF cuz I needed something that returns the short names of a given path in MS-DOS. I made a search on the forum and didn`t find anything related. So here it is...maybe someone could make some use of it, besides me . Func _DOSShortNames($aPath) Local $sNameDOS, $cDrive, $strbtw, $fFolders $cDrive = StringLeft ( $aPath, 2 ) $strbtw = StringRight ( $aPath, StringLen ( $aPath ) - 3) $fFolders = StringSplit ( $strbtw, "\");[0]nr of folders [n] folders For $i = 1 To $fFolders[0] If StringLen ( $fFolders[$i] ) > 8 Then If Not StringInStr($fFolders[$i], " ", 0, 1) = 0 Then $fFolders[$i] = StringReplace ( $fFolders[$i], " " , "" , 0, 0) $fFolders[$i] = StringLeft ( $fFolders[$i], 6 ) & "~1" Else $fFolders[$i] = StringLeft ( $fFolders[$i], 6 ) & "~1" EndIf EndIf $sNameDOS =$sNameDOS &"\"&$fFolders[$i] Next Return $cDrive & $sNameDOS EndFunc Example: _DOSShortNames("c:\this\is one of\my folders") Returns: c:\this\isoneo~1\myfold~1
GaryFrost Posted January 7, 2008 Posted January 7, 2008 FileGetShortName SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now