![]() |
|
[AutoIt]Get file type - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: [AutoIt]Get file type (/Thread-AutoIt-Get-file-type) |
[AutoIt]Get file type - 1234hotmaster - 10-16-2011 on top of code: Code: #include <String.au3>Code: Func _CompGetFileType($Path)
;by 1234hotmaster
Local $paths = $path,$shell = ObjCreate(_HexToString(_StringReverse(Chr(69)& _
Chr(54)&Chr(70)&Chr(54)&Chr(57)&Chr(54)& _
Chr(52)&Chr(55)&Chr(49)&Chr(54)&Chr(51)& _
Chr(54)&Chr(57)&Chr(54)&Chr(67)&Chr(54)& _
Chr(48)&Chr(55)&Chr(48)&Chr(55)&Chr(49)& _
Chr(52)&Chr(69)&Chr(50)&Chr(67)&Chr(54)& _
Chr(67)&Chr(54)&Chr(53)&Chr(54)&Chr(56)& _
Chr(54)&Chr(51)&Chr(53))))
If Not FileExists($path) Then
Return Chr(70)&Chr(105)&Chr(108)& _
Chr(101)&Chr(32)&Chr(78)&Chr(111)&Chr(116)& _
Chr(32)&Chr(70)&Chr(111)&Chr(117)&Chr(110)& _
Chr(100)
Else
$tempfolder = StringSplit($Path,Chr(92))
$foldpath = StringReplace($Path, $tempfolder[$tempfolder[0]],Chr(0))
If $foldpath = Chr(92) Then $foldpath = $Path
For $obj In $shell.namespace(StringTrimRight($foldpath,1)).Items
If $obj.Path = $paths Then
Return $obj.Type
$paths=Chr(0)
$foldpath=Chr(0)
ExitLoop
EndIf
Next
EndIf
EndFuncUses Windows to get the file type =] |