Script Content Plugin
Moderators: Hacker, petermad, Stefan2, white
Script Content Plugin
Script Content Plugin initial alfa.
Just an announcement.
I think interesting scripts can be posted here for sharing.
Just an announcement.
I think interesting scripts can be posted here for sharing.
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
Ok, first try. Here is a [face=courier]DiskDirSize.vbs[/face] script.
Code: Select all
'DiskDirSize.vbs by SanskritFritz
'Script for Script Content Plugin
'(c)Lev Freidin, 2005
'http://www.totalcmd.net/plugring/script_wdx.html
'http://wincmd.ru/plugring/script_wdx.html
'
'This script shows the virtual size of a DiskDir file,
'i.e. the size of the files listed therein.
'Warning: it gives a false result on DiskDir Extended files
'(because directories are assumed to have a size of 0)!
content = ""
Dim fso, oTextStream
Set fso = CreateObject( "Scripting.FileSystemObject" )
sExt = lcase( fso.GetExtensionName( filename ) )
Select Case sExt
case "lst", "ddr" ' lst is the suggested extension, I personally use ddr
Set oTextStream = fso.OpenTextFile( filename )
content = 0
Do Until oTextStream.AtEndOfStream
sLine = oTextStream.ReadLine
aFields = Split( sLine, " " ) ' <- This is a TAB character!
if Ubound( aFields ) > 1 then
content = content + aFields(1)
end if
Loop
content = FormatNumber( content, 0, -2, -2, -2 )
oTextStream.Close
End Select
Set fso = nothing
Set oTextStream = nothing
I switched to Linux, bye and thanks for all the fish!
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
-
- Member
- Posts: 103
- Joined: 2005-06-21, 00:42 UTC
Very nice and usefull plugin
My personal most wanted features are support for Subs/Functions in the code, and support of more than one column per script.
But also without this features... very usefull.
Following a little script, which can be usefull to search for files with a specified signature (first bytes in the file).

My personal most wanted features are support for Subs/Functions in the code, and support of more than one column per script.
But also without this features... very usefull.
Following a little script, which can be usefull to search for files with a specified signature (first bytes in the file).
Code: Select all
'signatur.vbs by ricobautsch
'Script for Script Content Plugin (c)Lev Freidin, 2005
'http://www.totalcmd.net/plugring/script_wdx.html
'http://wincmd.ru/plugring/script_wdx.html
'
'This script returns the first 10 bytes in the file as text or hex-representation.
'Could be usefull for example to search for files with a specified signatur
const bHex = True
const nCharCnt = 10
Set fso = CreateObject("Scripting.FileSystemObject")
Set oTextStream = fso.OpenTextFile(filename)
If not oTextStream.AtEndOfStream Then
content_str = oTextStream.Read(nCharCnt)
If bHex Then
For i=1 To Len(content_str)
If content <> "" Then
content = content & " "
End If
hex_value = Hex(Asc(Mid(content_str,i,1)))
content = content & string(2 - len(hex_value), "0")
content = content & hex_value
Next
Else
content = content_str
End If
End If
oTextStream.Close
- SanskritFritz
- Power Member
- Posts: 3693
- Joined: 2003-07-24, 09:25 UTC
- Location: Budapest, Hungary
Looking for help for addzeros.vbs
Hello
I found the script addzeros.vbs in the download file, and I'm asking for a little help.
Here is the original code:
This code works only for files which beginns with a letter: it works fine for x1.txt, x12.txt, x111.txt ...; but it doesnot work for 1.txt, 11.txt, 12.txt ...
What is the correct code do set a filename (consisting of numbers) to a triple digit number:
Peter
I found the script addzeros.vbs in the download file, and I'm asking for a little help.
Here is the original code:
Code: Select all
'Script for Script Content Plugin
'(c)Lev Freidin, 2005
'http://www.totalcmd.net/plugring/script_wdx.html
'http://wincmd.ru/plugring/script_wdx.html
'Add Zeros to filenames for better sorting
'file1.txt -> file001.txt
'file11.txt -> file011.txt
'file111.txt -> file111.txt
set re=new regexp
content=filename
re.Pattern="(\D)(\d\.)"
b="$100$2"
If re.test(filename) then content = re.Replace(filename,b)
re.Pattern="(\D)(\d{2}\.)"
b="$10$2"
If re.test(filename) then content = re.Replace(filename,b)
What is the correct code do set a filename (consisting of numbers) to a triple digit number:
- 1.txt -> 001.txt
02.txt -> 002.txt
11.txt -> 011.txt
111.txt -> 111.txt
Peter
TC 10.xx / #266191
Win 10 x64
Win 10 x64
Re: Looking for help for addzeros.vbs
Hello Peter,Peter wrote:Code: Select all
'Script for Script Content Plugin '(c)Lev Freidin, 2005 'http://www.totalcmd.net/plugring/script_wdx.html 'http://wincmd.ru/plugring/script_wdx.html 'Add Zeros to filenames for better sorting 'file1.txt -> file001.txt 'file11.txt -> file011.txt 'file111.txt -> file111.txt set re=new regexp content=filename re.Pattern="(.*)(\d\.)" b="$100$2" If re.test(filename) then content = re.Replace(filename,b) re.Pattern="(.*)(\d{2}\.)" b="$10$2" If re.test(filename) then content = re.Replace(filename,b)
I have not installed the plugin thus I cannot test the script. But deducing from the RegEx help in TC I would say you'll have to replace the \D (which means 'no number') with .* (any char zero or more occurances). I changed the script that way I think it should work as you asked for. But I haven't tried so please be careful.
sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams