AcidCorps Posted December 5, 2007 Share Posted December 5, 2007 expandcollapse popupFunc FileGetPiece($shFile, $xvFlag = 0) ;0 = All ;1 = Filename ;2 = Extension ;4 = Filename - Extension If $xvFlag = 0 Then Dim $vsOut[3]; 1, 2, 4 If $xvFlag = 1 Then Dim $vsOut[1]; 1 If $xvFlag = 2 Then Dim $vsOut[1]; 2 If $xvFlag = 3 Then Dim $vsOut[2]; 1, 2 If $xvFlag = 4 Then Dim $vsOut[1]; 4 If $xvFlag = 5 Then Dim $vsOut[2]; 1,4 If $xvFlag = 6 Then Dim $vsOut[2]; 2, 4 If $xvFlag = 1 Or $xvFlag = 2 Or $xvFlag = 4 Then Dim $vsOut[1] If $xvFlag = 3 Or $xvFlag = 5 Or $xvFlag = 6 Then Dim $vsOut[2] If $xvFlag = 0 Or $xvFlag = 1 Or $xvFlag = 3 Or $xvFlag = 5 Then $vsFilename = StringTrimLeft($shFile, StringInStr($shFile, '\', 0, -1)) If $xvFlag = 0 Or $xvFlag = 2 Or $xvFlag = 3 Or $xvFlag = 6 Then $vsExtension = '.' & StringTrimLeft($shFile, StringInStr($shFile, '.', 0 -1)) If $xvFlag = 0 Or $xvFlag = 4 Or $xvFlag = 5 Or $xvFlag = 6 Then $vsFile = StringTrimRight(StringReplace(StringTrimLeft($shFile, StringInStr($shFile, '\', 0, -1)), StringTrimLeft($shFile, StringInStr($shFile, '.', 0, -1)), ''), 1) If $xvFlag = 1 Then Return $vsFilename If $xvFlag = 2 Then Return $vsExtension If $xvFlag = 4 Then Return $vsFile If $xvFlag = 3 Then Dim $vsOut[2] $vsOut[0] = $vsFilename $vsOut[1] = $vsExtension Return $vsOut EndIf If $xvFlag = 5 Then Dim $vsOut[2] $vsOut[0] = $vsFilename $vsOut[1] = $vsFile Return $vsOut EndIf If $xvFlag = 6 Then Dim $vsOut[2] $vsOut[0] = $vsExtension $vsOut[1] = $vsFile Return $vsOut EndIf If $xvFlag = 7 Or $xvFlag = 0 Then Dim $vsOut[3] $vsOut[0] = $vsFilename $vsOut[1] = $vsExtension $vsOut[2] = $vsFile Return $vsOut EndIf EndFunc Examples: $File = 'C:\My File.au3' FileGetPiece($File, 1) Returns My File.au3 FileGetPiece($File, 2) Returns .au3 FileGetPiece($File, 4) Returns My File Combining the flags will result in an array containing the combined returns Link to comment Share on other sites More sharing options...
Valik Posted December 5, 2007 Share Posted December 5, 2007 _PathSplit() Look it up. Link to comment Share on other sites More sharing options...
AcidCorps Posted December 5, 2007 Author Share Posted December 5, 2007 .... 20 mins down the drain lol Link to comment Share on other sites More sharing options...
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