Login Register






[AutoIt]Get File Extension, Filename, and Parent directory from Path filter_list
Author
Message
[AutoIt]Get File Extension, Filename, and Parent directory from Path #1
Code:
Func CompGetFileExt($Path,$Dot=True) ;by 1234hotmaster If StringLen($Path) < 4 Then Return -1 $ret = StringSplit($Path,"\",2) If IsArray($ret) Then $ret = StringSplit($ret[UBound($ret)-1],".",2) If IsArray($ret) Then If $Dot Then $Dot = "." Else $Dot = "" EndIf Return $Dot & $ret[UBound($ret)-1] EndIf EndIf If @error Then Return -1 EndFunc

Code:
Func CompGetFileName($Path) ;by 1234hotmaster If StringLen($Path) < 4 Then Return -1 $ret = StringSplit($Path,"\",2) If IsArray($ret) Then Return $ret[UBound($ret)-1] EndIf If @error Then Return -1 EndFunc


Code:
Func CompGetParentDir($Path,$EndSeparator=False) ;by 1234hotmaster If StringLen($Path) < 4 Then Return -1 $ret = StringSplit($Path,"\",2) If IsArray($ret) Then Local $temp For $i = 0 To UBound($ret)-2 $temp &= $ret[$i] & "\" Next If Not $EndSeparator Then $temp = StringTrimRight($temp,1) $ret=Chr(0) Return $temp EndIf If @error Then Return -1 EndFunc
Pierce the life fibers with your drill.

Reply