ScriptWFX 1.1

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

Moderators: Hacker, petermad, Stefan2, white

ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

ScriptWFX 1.1

Post by *ricobautsch »

I have released version 1.1 of ScriptWFX.
It contains some minor enhancements and bugfixes. See section History in the help file.

Download
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3378
Joined: 2003-05-06, 11:46 UTC

Post by *Sir_SiLvA »

New Enhanced RSS_Feed.vbs sample script. Now supports FsGetFile and FsExecuteFile.
New Path parameter in ScriptWFX.ini now supports environment-variables, also for example %COMMANDER_PATH%
Fix Show error message, if Script could not be loaded
Fix Empty parameter for Path in ScriptWFX.ini now means Path of ScriptWFX.wfx
New New object "plugin" with properties "VersionHigh", "VersionLow" and "ScriptFileName"
Fix The second parameter in FsGetFile (LocalName) and FsPutFile (RemoteName) was not passed by reference
* The Helpfile has been Updated
* ScriptWFX is now compressed with UPX
Hoecker sie sind raus!
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Post by *ricobautsch »

* ScriptWFX is now compressed with UPX
Version 1.0 was UPX-compressed too.
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

script template

Post by *ricobautsch »

Because of a user question i have created a template script with all supported plugin functions.

Download template.vbs

Remark:
If you want to store this file in your scripts folder, you can prevent ScriptWFX listing it in the pluginroot by changing the files extension or set the file attribute hidden.
User avatar
KyleK
Junior Member
Junior Member
Posts: 68
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

I put together a little script for your nice plugin that bascially is a mod of the Filesystem.vbs example and creates some kind of "virtual" file system.

Today I discovered that the script fails when I enter a dir with single files bigger than 2,147,483,648 bytes (wich is 2GB).
My assumption is that the File.Size property of your script engine is of type CLng. Is this fixable by script or in your plugin? Would certainly be nice ;)

I must say, I really like the plugin. I'm trying to stop using VBScript though and would rather like to use RubyScript. Maybe you could add support for it?

You can find RubyScript here.

So long,

Kyle K.[/url]
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Fixed

Post by *ricobautsch »

@KyleK
Nice to read for me, that this plugin is usefull for me, and others too. Thanx.

You are right, the ScriptFile.Size property has a wrong datatype in my plugin. I have fixed this. New version with this fix is 1.11.
Download

Of course, i could add support for other scripting languages, but the most common problem is, that these languages has no support for plugin-essential things like reference parameters.
I don't know something about RubyScript, but as far as i could read in the last minutes the problem with the non-existence of reference parameters is also the case with RubyScript. Please correct me, if i'm wrong.
User avatar
KyleK
Junior Member
Junior Member
Posts: 68
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

Thanks for the fix, works like a charm :]

About the problem with reference parameters: I'm not yet very deep into Ruby, so I needed to do a little digging on the internet. Apparently in Ruby, all variables and objects are reference variables/objects. But: The assignment character ('=') creates copies of them. I also found in a Ruby FAQ this sentence:
There is no equivalent of other language's pass-by-reference semantics. (Link)


It seems to confirm your findings.
However, Ruby does support multiple return values:

Code: Select all

def swap(a, b)
  a,b = b, a
end

x = 1
y = 2
puts "pre: x = #{x}, y = #{y}"
x,y = swap(x, y)
puts "post: x = #{x}, y = #{y}"
Result:
pre: x = 1, y = 2
post: x = 2, y = 1

Not sure if this can be of help for you. There probably are other ways to deal with that (e.g. Singleton methods in classes), question is if it's worth the effort ;)

This link might be of interest to you as well.

So long,

Kyle K.
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

parameter passing and other problems with RubyScript

Post by *ricobautsch »

I had already read about multiple return values, bindings and the other features supported by Ruby. But the most needed for my plugin, passing parameters by reference, is not supported.
Ruby would need another semantic plugin-implementation for parameter-exchange between the plugin and the script.

However, i have installed Ruby, modified my plugin to read Ruby-scripts, and tried to get Ruby-scripts running with my plugin. I could not test the parameter problem, because there was a problem prior to calling script-functions. It seems that the Ruby engine does not support some Interfaces needed for the scripting host to get some code-metrics, for example a procedure collection within a module.

All over, i would say it's in principle possible to support Ruby, but it would be a lot of work and include compromises for the plugins native language, VBScript.

Why are you trying to stop using VBScript?
What are the advantages of Ruby over VBScript?
User avatar
KyleK
Junior Member
Junior Member
Posts: 68
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

I've been scripting in VBScript for quite a while (the IRC clientI use has VBScript support among other languages), so it's not a big deal, I know what to do.
I recently discovered Ruby though and find it much easier to work with personally. I especially like the fact that it's completely object-oriented and everything is an object by definition. It has also some nice "tricks" that make writing little scripts easier in my opinion.

But anyway, if the interface isn't there don't bother with it anymore. It's not that important and honestly, I'm currently out of ideas for what to script for TCmd ;)

Thanks for investigating though.
User avatar
KyleK
Junior Member
Junior Member
Posts: 68
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

Hi,

me again ;)
I have a bit of a problem with one of the properties of the ScriptFiles Object.
I want to check if a specific item already exists as an object within the ScriptFiles collection (in my case, I don't want to have the same file/folder name twice in the list).

In your help file you write:
If Index is text, this property returns the ScriptFile where property name is this index. Example: Item("file1.txt") returns the item with property Name = file1.txt. If there is no item with this name in the Collection, the return-value will be NOTHING.
I then tried this:

Code: Select all

Set Files = ScriptFiles.Item(f.Name)
if Files = nothing then
' do something
end if
...
This code gives an error:

Code: Select all

Error: 91
Description: Object variable not set
(on the line "if Files = nothing then")

I also tried this:

Code: Select all

Set Files = ScriptFiles.Item(f.Name)
if IsObject(File) then
' do something
end if
Here, IsObject never fails (it is always true, even if there is already an item named f.Name.

What am I doing wrong, or: How can I check properly if Script.Item(..) returns NOTHING?[/code]
User avatar
Lev
Junior Member
Junior Member
Posts: 82
Joined: 2004-12-14, 13:08 UTC

Post by *Lev »

try:
if Files is nothing then
User avatar
KyleK
Junior Member
Junior Member
Posts: 68
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

Nope,

didn't work :/
Same error as above:
"Object variable not set."

File doesn't become an object, therefore this code seems to fail. But how to check for this scenario?
ricobautsch
Member
Member
Posts: 103
Joined: 2005-06-21, 00:42 UTC

Post by *ricobautsch »

Look at this simple script. It's working and adds the file "file_NOT_found.txt".

Code: Select all

Function FsFindFiles(ByVal Path)
  Set FoundFile = ScriptFiles.Item("will_not_be_found.txt")
  if FoundFile is Nothing then
    ScriptFiles.Add("file_NOT_found.txt")
  else
    ScriptFiles.Add("file_found.txt")
  end if
  FsFindFiles = True
End Function

Consider to declare variables with DIM, if your script contains the "OPTION EXPLICIT" statement.

If nothing helps, you can post your whole script, so i can find the problem.

ricobautsch
User avatar
KyleK
Junior Member
Junior Member
Posts: 68
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

Thanks Rico.
It seems the problem was that I initialized a variable twice using "Set File =".
For some reason it didn't like that. It works fine now though ;)

I'm still tweaking the script a little bit, after that I'll post it here for everyone's use.
User avatar
KyleK
Junior Member
Junior Member
Posts: 68
Joined: 2003-04-11, 12:33 UTC
Location: Dresden

Post by *KyleK »

KyleK wrote:I put together a little script for your nice plugin that bascially is a mod of the Filesystem.vbs example and creates some kind of "virtual" file system.

Today I discovered that the script fails when I enter a dir with single files bigger than 2,147,483,648 bytes (wich is 2GB).
My assumption is that the File.Size property of your script engine is of type CLng. Is this fixable by script or in your plugin? Would certainly be nice ;)
I discovered the other day that ScriptWFX has problems with file sizes larger than 4GB. This becomes problematic when copying something from the script results. I often use Shift-Alt-Enter to determin the file sizes of directories, but ScriptWFX will return wrong values.
Could you please take a look and see if you can fix it?

Thanks.
Post Reply