|
Viewing Code Snippet → $fileinfo & $findfileinfo - up to 37 types of info.
Projects's information
| Project Name |
: |
$fileinfo & $findfileinfo - up to 37 types of info |
| File Size |
: |
31.104 kb |
| Author |
: |
FiberOPtics |
| Project Description |
: |
Returns up to 37 characteristics of any file.
For example, various information regarding any type of audio file, video file, executables, etc. |
| Line Numbers |
: |
Hide Lines Number |
alias fileinfo {
var %r = return $+($chr(3),$color(info),$,fileinfo:), %result
if (!$isid) %r
if ($version < 5.91) %r This snippet requires atleast mIRC 5.91.
if ($os isin 9598) %r This snippet can only work on Windows ME or higher.
if (* !iswm $2) %r You didn't specify a property to retrieve.
if (!$isfile($1)) %r File doesn't exist: $1
var %mss = mss $+ $ticks, %t, %n = $crlf, %list, %sep = $iif($len($3)," $+ $3",vblf), %file = $1
var %props = $&
Name Size Type DateModified DateCreated DateAccessed Attributes Status Owner Author Title $&
Subject Category Pages Comments Copyright Artist AlbumTitle Year TrackNumber Genre Duration $&
BitRate Protected CameraModel DatePictureTaken Dimensions . . EpisodeName ProgramDescription . $&
Audiosamplesize Audiosamplerate Channels Company Description FileVersion ProductName ProductVersion
tokenize 32 $2
while ($0) {
if ($1 != .) && ($findtok(%props,$1,1,32)) %list = $addtok(%list,$+(",$1 $calc($ifmatch -1),"),44)
tokenize 32 $2-
}
if (!%list) %r You didn't supply any valid properties.
.comopen %mss MSScriptControl.ScriptControl
if ($comerr) %r Error opening ScriptControl object.
%t = $com(%mss,language,4,bstr*,vbscript)
%t = $&
dim list, tmp, prop, res %n $&
list = array( %list ) %n $&
set shell = createobject("shell.application") %n $&
set folder = shell.namespace( $+(",$iif($nofile(%file) != $null,$ifmatch,$mircdir),") ) %n $&
set item = folder.parsename( $+(",$nopath(%file),") ) %n $&
for each param in list %n $&
tmp = split(param," ") %n $&
prop = folder.getdetailsof(item,tmp(1)) %n $&
if len(prop) = 0 then prop = 0 %n $&
$iif($prop != raw,prop = tmp(0) & ": " & prop) %n $&
res = res & prop & %sep %n $&
next %n $&
set item = nothing : set folder = nothing : set shell = nothing %n $&
res = left(res,len(res)-len( %sep ))
if ($com(%mss,executestatement,1,bstr*,%t)) && ($com(%mss,eval,3,bstr*,res)) {
%result = $com(%mss).result
}
else %result = Error executing VBScript to retrieve fileinfo.
:error
if ($com(%mss)) .comclose %mss $com(%mss,reset,1)
return %result
}
alias findfileinfo {
if (!$isid) return
var %t, %obj = findfileinfo
if ($1 == initialize) {
var %r = return $+($chr(3),$color(info),$,%obj:)
if ($version < 5.91) %r This snippet requires atleast mIRC 5.91.
if ($os isin 9598) %r This snippet can only work on Windows ME or higher.
if (* !iswm $2) %r you must specify properties to retrieve.
if ($com(%obj)) .comclose %obj
.comopen %obj MSScriptControl.ScriptControl
var %sep = $iif($len($3)," $+ $3",vblf), %n = $crlf, %list
var %props = $&
Name Size Type DateModified DateCreated DateAccessed Attributes Status Owner Author Title $&
Subject Category Pages Comments Copyright Artist AlbumTitle Year TrackNumber Genre Duration $&
BitRate Protected CameraModel DatePictureTaken Dimensions . . EpisodeName ProgramDescription . $&
Audiosamplesize Audiosamplerate Channels Company Description FileVersion ProductName ProductVersion
tokenize 32 $2
while ($0) {
if ($1 != .) && ($findtok(%props,$1,1,32)) %list = $addtok(%list,$+(",$1 $calc($ifmatch -1),"),44)
tokenize 32 $2-
}
if (!%list) %r you didn't specify any valid properties.
%t = $com(%obj,language,4,bstr*,vbscript)
%t = $&
Function FindFileInfo(dir,file) %n $&
list = array( %list ) %n $&
set shell = createobject("shell.application") %n $&
set folder = shell.namespace(dir) %n $&
set item = folder.parsename(file) %n $&
for each param in list %n $&
tmp = split(param," ") %n $&
prop = folder.getdetailsof(item,tmp(1)) %n $&
if len(prop) = 0 then prop = 0 %n $&
$iif($prop != raw,prop = tmp(0) & ": " & prop) %n $&
%obj = %obj & prop & %sep %n $&
next %n $&
set item = nothing : set folder = nothing : set shell = nothing %n $&
%obj = left( %obj ,len( %obj )-len( %sep )) %n $&
End Function
%t = $com(%obj,addcode,1,bstr*,%t)
return $iif(%t == 1,$true,$false)
}
elseif ($1 == quit) && ($com(%obj)) .comclose %obj $com(%obj,reset,1)
else {
if (!$com(%obj)) || (!$isfile($1)) return
%t = FindFileInfo( $+(",$nofile($1),",$chr(44),",$nopath($1),") )
%t = $com(%obj,eval,3,bstr*,%t)
return $com(%obj).result
}
}
alias listtags {
var %e = !echo -ac info * /listtags:
if ($version < 6.14) { %e this alias requires atleast mIRC 6.14 | return }
var %objShell = objshell $+ $ticks, %objFolder = objfolder $+ $ticks, %i = 0, %t
.comopen %objShell shell.application
if ($comerr) { %e error opening Shell.Application object | return }
%t = $com(%objShell,namespace,1,bstr,$mircdir,dispatch* %objFolder)
if ($com(%objFolder)) {
!echo -ac info * Listing available properties on your system...
while (%i < 40) {
%t = $com(%objFolder,getdetailsof,1,bstr*,null,uint,%i)
!echo -a Index %i - $com(%objFolder).result
inc %i
}
.comclose %objFolder
}
.comclose %objShell
}
alias fileinfo {
var %r = return $+($chr(3),$color(info),$,fileinfo:), %result
if (!$isid) %r
if ($version < 5.91) %r This snippet requires atleast mIRC 5.91.
if ($os isin 9598) %r This snippet can only work on Windows ME or higher.
if (!$isfile($1)) %r File doesn't exist: $1
if (* !iswm $2) %r You didn't specify a property to retrieve.
var %mss = mss $+ $ticks, %t, %n = $crlf, %list, %sep = $iif($len($3)," $+ $3",vblf), %file = $1
var %props = $&
Name Size Type DateModified DateCreated DateAccessed Attributes Status Owner Author Title $&
Subject Category Pages Comments Copyright Artist AlbumTitle Year TrackNumber Genre Duration $&
BitRate Protected CameraModel DatePictureTaken Dimensions . . EpisodeName ProgramDescription . $&
Audiosamplesize Audiosamplerate Channels Company Description FileVersion ProductName ProductVersion
tokenize 32 $2
while ($0) {
if ($1 != .) && ($findtok(%props,$1,1,32)) %list = $addtok(%list,$+(",$1 $calc($ifmatch -1),"),44)
tokenize 32 $2-
}
if (!%list) %r You didn't supply any valid properties.
.comopen %mss MSScriptControl.ScriptControl
if ($comerr) %r Error opening ScriptControl object.
%t = $com(%mss,language,4,bstr*,vbscript)
%t = $&
dim list, tmp, prop, res %n $&
list = array( %list ) %n $&
set shell = createobject("shell.application") %n $&
set folder = shell.namespace( $+(",$iif($nofile(%file) != $null,$ifmatch,$mircdir),") ) %n $&
set item = folder.parsename( $+(",$nopath(%file),") ) %n $&
for each param in list %n $&
tmp = split(param," ") %n $&
prop = folder.getdetailsof(item,tmp(1)) %n $&
if len(prop) = 0 then prop = 0 %n $&
$iif($prop != raw,prop = tmp(0) & ": " & prop) %n $&
res = res & prop & %sep %n $&
next %n $&
set item = nothing : set folder = nothing : set shell = nothing %n $&
res = left(res,len(res) - len( %sep ))
if ($com(%mss,executestatement,1,bstr*,%t)) && ($com(%mss,eval,3,bstr*,result)) {
%result = $com(%mss).result
}
else %result = Error executing VBScript to retrieve fileinfo.
: something like: set shell = nothing. Normally this works in VBScript, but the Script Interpreter
: doesn't perform it properly, therefore the reset method.
:error
if ($com(%mss)) .comclose %mss $com(%mss,reset,1)
return %result
}
alias findfileinfo {
if (!$isid) return
var %t, %obj = findfileinfo
if ($1 == initialize) {
var %r = return $+($chr(3),$color(info),$,findfileinfo:)
if ($version < 5.91) %r This snippet requires atleast mIRC 5.91.
if ($os isin 9598) %r This snippet can only work on Windows ME or higher.
if (* !iswm $2) %r you must specify properties to retrieve.
if ($com(%obj)) .comclose %obj
.comopen %obj MSScriptControl.ScriptControl
var %sep = $iif($len($3)," $+ $3",vblf), %n = $crlf, %list
var %props = $&
Name Size Type DateModified DateCreated DateAccessed Attributes Status Owner Author Title $&
Subject Category Pages Comments Copyright Artist AlbumTitle Year TrackNumber Genre Duration $&
BitRate Protected CameraModel DatePictureTaken Dimensions . . EpisodeName ProgramDescription . $&
Audiosamplesize Audiosamplerate Channels Company Description FileVersion ProductName ProductVersion
tokenize 32 $2
while ($0) {
if ($1 != .) && ($findtok(%props,$1,1,32)) %list = $addtok(%list,$+(",$1 $calc($ifmatch -1),"),44)
tokenize 32 $2-
}
if (!%list) %r you didn't specify any valid properties.
%t = $com(%obj,language,4,bstr*,vbscript)
%t = $&
Function FindFileInfo(dir,file) %n $&
dim list, tmp, prop, %obj %n $&
list = array( %list ) %n $&
set shell = createobject("shell.application") %n $&
set folder = shell.namespace(dir) %n $&
set item = folder.parsename(file) %n $&
for each param in list %n $&
tmp = split(param," ") %n $&
prop = folder.getdetailsof(item,tmp(1)) %n $&
if len(prop) = 0 then prop = 0 %n $&
$iif($prop != raw,prop = tmp(0) & ": " & prop) %n $&
%obj = %obj & prop & %sep %n $&
next %n $&
set item = nothing : set folder = nothing : set shell = nothing %n $&
%obj = left( %obj ,len( %obj )-len( %sep )) %n $&
End Function
%t = $com(%obj,addcode,1,bstr*,%t)
return $iif(%t == 1,$true,$false)
}
elseif ($1 == quit) && ($com(%obj)) .comclose %obj $com(%obj,reset,1)
else {
if (!$com(%obj)) || (!$isfile($1)) return
%t = FindFileInfo( $+(",$nofile($1),",$chr(44),",$nopath($1),") )
| | |