This forum uses cookies. Click X button to hide this message. What is stored? 
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Script Content Plugin
Goto page 1, 2, 3, 4  Next
 
Post new topic   Reply to topic    Total Commander Forum Index -> Plugins and addons: devel.+support (English) Printable version
View previous topic :: View next topic  
Author Message
Lev
Junior Member
Junior Member


Joined: 14 Dec 2004
Posts: 82

PostPosted: Sun Sep 25, 2005 6:12 am    Post subject: Script Content Plugin Reply with quote

Script Content Plugin initial alfa.
Just an announcement.
I think interesting scripts can be posted here for sharing.
Back to top
View user's profile Send private message Send e-mail
SanskritFritz
Power Member
Power Member


Joined: 24 Jul 2003
Posts: 3693
Location: Budapest, Hungary

PostPosted: Sun Sep 25, 2005 7:29 am    Post subject: Reply with quote

Nice, i just tried it, thanks! Whenever I have new scripts, i will post them here!
_________________
I switched to Linux, bye and thanks for all the fish!
Back to top
View user's profile Send private message Send e-mail
SanskritFritz
Power Member
Power Member


Joined: 24 Jul 2003
Posts: 3693
Location: Budapest, Hungary

PostPosted: Tue Sep 27, 2005 2:31 pm    Post subject: Reply with quote

Ok, first try. Here is a DiskDirSize.vbs script.

Code:
'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!
Back to top
View user's profile Send private message Send e-mail
Lev
Junior Member
Junior Member


Joined: 14 Dec 2004
Posts: 82

PostPosted: Wed Sep 28, 2005 6:18 am    Post subject: Reply with quote

Thanks for your script!

Silent update - I've added "exe-files-up" script example to the plugin, without plugin itself changes
Back to top
View user's profile Send private message Send e-mail
SanskritFritz
Power Member
Power Member


Joined: 24 Jul 2003
Posts: 3693
Location: Budapest, Hungary

PostPosted: Wed Sep 28, 2005 6:42 am    Post subject: Reply with quote

Thanks, nice idea! IIRC this was requested many times here in the forum.
Hmm, time to open a wiki section for these scripts?
_________________
I switched to Linux, bye and thanks for all the fish!
Back to top
View user's profile Send private message Send e-mail
Lev
Junior Member
Junior Member


Joined: 14 Dec 2004
Posts: 82

PostPosted: Wed Sep 28, 2005 7:07 am    Post subject: Reply with quote

SanskritFritz wrote:
Hmm, time to open a wiki section for these scripts?

I don't know, the plugin is rather buggy yet...
and I'm planning some changes like several columns, js-scripts support and so on
Back to top
View user's profile Send private message Send e-mail
SanskritFritz
Power Member
Power Member


Joined: 24 Jul 2003
Posts: 3693
Location: Budapest, Hungary

PostPosted: Wed Sep 28, 2005 7:10 am    Post subject: Reply with quote

Ok, even though it works like charm for me here.
I meant only the scripts, they will not have to be changed do they? Oh, now I just see, multi columns will change them, ok.
_________________
I switched to Linux, bye and thanks for all the fish!
Back to top
View user's profile Send private message Send e-mail
Lev
Junior Member
Junior Member


Joined: 14 Dec 2004
Posts: 82

PostPosted: Wed Sep 28, 2005 8:04 am    Post subject: Reply with quote

It is impossible to use subroutines in scripts currently, it need's to be repaired. It can cause some changes in scripts too.
Back to top
View user's profile Send private message Send e-mail
SanskritFritz
Power Member
Power Member


Joined: 24 Jul 2003
Posts: 3693
Location: Budapest, Hungary

PostPosted: Wed Sep 28, 2005 12:13 pm    Post subject: Reply with quote

I hope you will have the time and motivation to continue with this awesome plugin! Thanks again for it!
_________________
I switched to Linux, bye and thanks for all the fish!
Back to top
View user's profile Send private message Send e-mail
ricobautsch
Member
Member


Joined: 20 Jun 2005
Posts: 103

PostPosted: Tue Oct 04, 2005 6:24 pm    Post subject: Reply with quote

Very nice and usefull plugin Very Happy
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:
'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
Back to top
View user's profile Send private message
SanskritFritz
Power Member
Power Member


Joined: 24 Jul 2003
Posts: 3693
Location: Budapest, Hungary

PostPosted: Wed Oct 05, 2005 6:25 am    Post subject: Reply with quote

2ricobautsch
Nice idea!
_________________
I switched to Linux, bye and thanks for all the fish!
Back to top
View user's profile Send private message Send e-mail
Lev
Junior Member
Junior Member


Joined: 14 Dec 2004
Posts: 82

PostPosted: Wed Oct 05, 2005 11:33 am    Post subject: Reply with quote

2ricobautsch
Thanks for interesting script
------------
I've added js support to plugin, but since I don't use js myself, the example is very simple

support for Subs/Functions in the code, and support of more than one column per script are still in work
Back to top
View user's profile Send private message Send e-mail
Peter
Power Member
Power Member


Joined: 13 Nov 2003
Posts: 1814
Location: Schweiz

PostPosted: Fri Nov 04, 2005 3:14 pm    Post subject: Looking for help for addzeros.vbs Reply with quote

Hello

I found the script addzeros.vbs in the download file, and I'm asking for a little help.

Here is the original code:

Code:
'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)



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:

    1.txt -> 001.txt
    02.txt -> 002.txt
    11.txt -> 011.txt
    111.txt -> 111.txt


Thanks in advance

Peter
_________________
TC 9.0a / #266191
Win 7 x64 / Win 10 x64
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Sheepdog
Power Member
Power Member


Joined: 18 Dec 2003
Posts: 5150
Location: Berlin, Germany

PostPosted: Fri Nov 04, 2005 4:15 pm    Post subject: Re: Looking for help for addzeros.vbs Reply with quote

Peter wrote:
Code:
'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)



Hello Peter,

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Peter
Power Member
Power Member


Joined: 13 Nov 2003
Posts: 1814
Location: Schweiz

PostPosted: Sat Nov 05, 2005 2:10 am    Post subject: Reply with quote

Thanks

I will test it on Monday.

Peter
_________________
TC 9.0a / #266191
Win 7 x64 / Win 10 x64
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> Plugins and addons: devel.+support (English) All times are GMT - 6 Hours
Goto page 1, 2, 3, 4  Next
Page 1 of 4

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Impressum: This site is maintained by Ghisler Software GmbH

Using phpBB © 2001-2005 phpBB Group