New FileSystem plugin - ScriptWFX 1.0

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

User avatar
Vansumsen
Power Member
Power Member
Posts: 761
Joined: 2003-11-09, 08:16 UTC
Location: Belgique
Contact:

Post by *Vansumsen »

Sorry - I can NOT find the least trace of German in the ScriptWFX.zip archive. Where do you find that?
Extracted from ScriptWFX.wfx :D

Code: Select all

Dispatch-Schnittstelle für ScriptFile-ObjektWW ScriptFile ObjektW- Dispatch-Schnittstelle für ScriptFiles-ObjektW ScriptFiles Objekt' Dispatch-Schnittstelle für TcApi-ObjektWWW TcApi ObjektWW' Dispatch-Schnittstelle für Utils-Objekt
and probably broadcasted to Clo's little finger... :wink:

Paul
Ouistiti, #11943

L'important n'est pas de convaincre, mais de donner à réfléchir.
The important thing is not to convince, but to incite to think.

1,77245385090552...
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

I have installed your plugin at a (virtual) Windows 98 machine.

The plugin is working but since I try to use your examples it crashes.

Yes I have installed the (german) ScriptConntrol. I did download it just a few minutes ago. I get german error messages when the Local Filesystem Plugin crashes:

Code: Select all

Ungültiger Prozeduraufruf oder ungültiges Argument

Error: 5
Source: Laufzeitfehler in Microsoft VBScript
Description: Ungültiger Prozeduraufruf oder ungültiges Argument
Text:
Line, Column:28, 10

And after that

Code: Select all

External Exeption EEDFADE

Please report....
The RSS-Plugin produces:

Can not open URL, Message: Object erforderlich (424)

And the Outlook makes this and again the EEDFADE exeption.

Guess there are some problems with w98.

sheepdog

BTW on my XP SP2 System it works fine.
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3378
Joined: 2003-05-06, 11:46 UTC

Post by *Sir_SiLvA »

Sheepdog wrote:The RSS-Plugin produces:
Can not open URL, Message: Object erforderlich (424)
Guess there are some problems with w98.
Nope under winxppro sp2 the rss-script also does nothing that showing the rss-items but is not able to show the text by pressing enter or f3...
Hoecker sie sind raus!
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Post by *ricobautsch »

@Vansumsen
These strings are never presented to the user.

@Sheepdog
The Error message presented to you comes not from the ScriptWFX plugin, they are produced from your german Microsoft Scripting Runtime. The plugin only displays the message received from the Scripting Runtime.

Meanwhile i also have a Windows 98 SE running as a virtual machine.
I can reproduce the crash in the Local Filesystem -script.
You can fix this in the script to get the sample running.
- Open "Local Filesystem.vbs" with an editor
- Search for the following lines
.CreationTime = f.DateCreated
.LastAccessTime = f.DateLastAccessed
- Comment out any found line (a total of 4 lines) by adding ' at the beginning of the line
- Unload Plugins or restart TC for the changed script to take effect
I don't know at the moment about the reason of this error, but TC anyway show DateLastModified, so after the fix all is fine.

The RSS sample has some special system requirements. Please have a look inside "RSS_Feed.vbs", where it's documented. It cannot run in Windows 98.

Your Error with the Outlook sample tells you, that you have not installed Microsoft Outlook. Maybe you have Outlook Express, but it's not the same and the sample is looking for Microsoft Outlook.

@Sir_SiLva
The RSS and the Outlook samples are not full-featured. Only some minimum API functions are implemented. They are intended to show the possibilities, not as real usefull plugins. So for example the FsGetFile (which is the API function called if you press F3) is not implemented in these samples.
User avatar
Ergo
Senior Member
Senior Member
Posts: 204
Joined: 2003-02-05, 12:20 UTC
Location: Belarus
Contact:

Post by *Ergo »

2ricobautsch

Please let me know if you want to place your plugin on www.totalcmd.net
mailto:webmaster@wincmd.ru
Wincmd.ru WWW.TOTALCMD.NET
I see that future is near...
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Another sample script

Post by *ricobautsch »

To all of you, who are interested in writing scripts, here's another small example. It will show you the icons in your shell32.dll. Hint: Try the brief and thumbnail-view in TC when viewing the icons.

To get the sample working, simply copy&paste the following code to a new file in your scripts-folder. Extension of this file must be "vbs". A good choice for the filename, i think, would be "Icons in shell32.dll.vbs".

Remark:
This sample uses a feature, which i forgot to document in the helpfile.
If you pass -1 as the second parameter in utils.ExtractIcon, the function will return the total count of icons in the file.

Code: Select all

'This is a sample script for the ScriptWFX plugin
'It shows you the icons from your shell32.dll

' plugin functions -------------------------------------------------------------
Function FsFindFiles(Path)
  if Path = "\" then
    IcoCount = utils.ExtractIcon("shell32.dll", -1, True)
    for i=0 to IcoCount-1
      ScriptFiles.Add(FillStrLeft(i, 4, "0"))
    next
    FsFindFiles = True
  end if
End Function

Function FsExtractCustomIcon(ByRef RemoteName, ByVal ExtractFlags, ByRef TheIcon)
  if Right(RemoteName,1) <> "\" then
    Idx = Mid(RemoteName, 2)
    bSmall = ExtractFlags and FS_ICONFLAG_SMALL
    
    TheIcon = utils.ExtractIcon("shell32.dll", Idx, bSmall)
    FsExtractCustomIcon = FS_ICON_EXTRACTED_DESTROY
  end if
End Function

'-- util functions -----------------------------------------------------------
Function FillStrLeft(Value, Length, FillChar)
  FillStrLeft = String(Length - Len(Value), FillChar) & Value
End Function
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3378
Joined: 2003-05-06, 11:46 UTC

Post by *Sir_SiLvA »

ricobautsch wrote: @Sir_SiLva
The RSS and the Outlook samples are not full-featured. Only some minimum API functions are implemented. They are intended to show the possibilities, not as real usefull plugins.
So this means there is NO possibility to show the text in the rss-reader with pressing F3?
Hoecker sie sind raus!
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Post by *ricobautsch »

@Sir_SiLva
I only would not overweight the examples. They are EXAMPLES, and should be fast understandable.
Possibilities are big, bigger, biggest.

Ok, i have enhanced the RSS_Feed example a little bit. Now it supports the FsGetFile, so you can use the F3 and F5 in TC. To get it readable and with links, you should switch to "HTML text (strip tags)"-view in TC's lister.

Download the script from here.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2Sir_SiLvA
This is not an end product. This is a new language platform for plugin developers. The scripts included are only for demo purposes, to better understanding the methods used by plugin writers. You still have to wait for plugin writers to develop full featured and meaningful plugins utilising this platform.
I switched to Linux, bye and thanks for all the fish!
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3378
Joined: 2003-05-06, 11:46 UTC

Post by *Sir_SiLvA »

SanskritFritz wrote:2Sir_SiLvA
This is not an end product. This is a new language platform for plugin developers. The scripts included are only for demo purposes, to better understanding the methods used by plugin writers. You still have to wait for plugin writers to develop full featured and meaningful plugins utilising this platform.
Sorry but if someone does a rss-stuff for tc a thing that
surly ever1 waited for is it to much asked to make the demo
complete - im surly not the only one that has no idea about vb
(i never liked vb :-))

@ricobautsch: thx a lot :-)
Hoecker sie sind raus!
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Post by *ricobautsch »

@SanskritFritz
Thx for your description in other words, and also for your very positive response

@Sir_SiLvA
My pleasure.
Sven
Member
Member
Posts: 111
Joined: 2003-02-10, 21:32 UTC
Location: Varel, Germany
Contact:

Post by *Sven »

@ricobautsch: Amazing plugin!

@Sir_SiLvA: Add the following lines to RSS_Feed.vbs:

Code: Select all

Dim RSSDoc

Function FsGetFile(ByVal RemoteName, ByVal LocalName, ByVal CopyFlags)

    On Error Resume Next

    strRemoteName = Mid(RemoteName, 2)
    
    If not (RSSDoc is Nothing) Then
      Set Nodes = RSSDoc.selectNodes("//item")
      For Each Node In Nodes
		strTitle = Node.selectSingleNode("title").Text & "." &_  
                      Node.selectSingleNode("dc:creator").Text 
	   	if (strTitle = strRemoteName) then
	   	
	   		Set fileSystem = CreateObject("Scripting.FileSystemObject")
	   		Set textStream = fileSystem.CreateTextFile(LocalName, True)
	   		
	   		strText = Node.selectSingleNode("description").Text
	   		strText = Replace (strText, "<br />", "")
	   		strText = Replace (strText, "<span class=""postbody"">", "")
	   		strText = Replace (strText, "<span style=""font-weight: bold"">", "")
	   		strText = Replace (strText, "</span>", "")
	   		strText = Replace (strText, "<", "<")
	   		strText = Replace (strText, ">", ">")
	   		
	   		textStream.Write(strText)
	   	
			end if
      Next
      
    End If

End Function

Function FsExecuteFile(ByVal MainWin, ByRef RemoteName, ByVal Verb) 

    On Error Resume Next
    
    strRemoteName = Mid(RemoteName, 2)

    If not (RSSDoc is Nothing) Then
      Set Nodes = RSSDoc.selectNodes("//item")
      For Each Node In Nodes
		strTitle = Node.selectSingleNode("title").Text & "." &_  
                      Node.selectSingleNode("dc:creator").Text 
	   	if (strTitle = strRemoteName) then
	   	
	   		Set shell = CreateObject("Shell.Application")
	   		shell.ShellExecute (Node.selectSingleNode("link").Text)
	   		
			end if
      Next
      
    End If
    
    FsExecuteFile = 0

End Function
Last edited by Sven on 2005-06-23, 21:42 UTC, edited 2 times in total.
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Post by *ricobautsch »

@Sven
A good solution :-)
You can improve performance by declaring the RSSDoc global, so you don't have to reload it on every FsGetFile or FsExecuteFile.

Add the following code at the beginning of the script, outside of any function:

Code: Select all

Dim RSSDoc
Now remove the following line from FsGetFile and FsExecuteFile:

Code: Select all

Set RSSDoc = LoadDOMDocument("http://ghisler.ch/board/rss.php?t=1") 
@All
For all who can't interpret Sven's code, here is a short description of what it will do:

It shows you the content of a Feed-item by pressing F3 or copy it to your local harddisk with F5.
Furthermore it opens your internet-browser with the original thread from the official TC forum, when executing the item (Enter, DoubleClick).
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3378
Joined: 2003-05-06, 11:46 UTC

Post by *Sir_SiLvA »

So, how how do I get a better Exception-Handling for this Scripting-Plugin?

Reason:
here you find my rss-script a little modiefied:
http://rapidshare.de/files/2571309/RSS_Feed.zip.html

When pressing F3 I get this error:

Code: Select all

Erlaubnis verweigert
Error: 70
Source: Laufzeitfehler in Microsoft VBScript
Description: Erlaubnis verweigert
Text:
Line, Column: 20, 12
and some others Im getting:

Code: Select all

Ungültige(r) Dateiname oder -nummer
Error: 52
Source: Laufzeitfehler in Microsoft VBScript
Description: Ungültige(r) Dateiname oder -nummer
Text:
Line, Column: 20, 12
As you see the error is allways this line:

Code: Select all

Set textStream = fileSystem.CreateTextFile(LocalName, True)
Is there nothing like try...execept...end in delphi in vbscript?
After these error the only way to continue work with tc is saying no when tc ask if he should continue after the fail cuase the work in progress dialog doesnt get closed...

all in all nice try but still miles away from rss in tc
(try readeing threads with "?" in Title....)

And the Last prob:
strTest = Replace (strText, "<span style=""font-weight: bold"">", "")
strText = Replace (strText, "</span>", "")
strTest = Replace (strText, "<", "<")
strTest = Replace (strText, ">", ">")
arent executed?

@Sven: thx 4 your code...
Hoecker sie sind raus!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2Sir_SiLvA
:lol: first you show yourself as a total ignorant, then it turns out you are a programmer ;-)
I switched to Linux, bye and thanks for all the fish!
Post Reply