Multi Commander > Script
Recursive file search
Mathias (Author):
--- Quote from: Suncatcher on February 17, 2016, 21:44:28 ---Several other critical points that should be emphasized:
1. No complex conditions can be built in IF clause.
--- Code: ---if(A == B OR (B == C AND D == E) ) {}
--- End code ---
Or I am mistaken? I didn't find anything in documentation.
--- End quote ---
No that is not included yet. I have not had a need for that yet. So it has not been added.
But you can simulate it with script functions. ( like ADD(..) and OR(..) that return 0/1 )
--- Quote from: Suncatcher on February 17, 2016, 21:44:28 ---2. The behavior of script interpreter with IF clause is undefined. One time it threw the exception with totally correct piece which is on the picture 1.
Another time it behaved itself totally unexpectedly with this piece of code.
--- Code: --- if(arrayCount($inlsdfiles) == 0)
{
}
else if(arrayCount($indslfiles) == 0)
{
}
else
{
@var $arr[] = PathGetParts($file[$n]);
@var $path[] = {};
arrayAdd($path, $arr[2]);
@var $num = SetSourceSelected($path, 1);
}
--- End code ---
During rendering this piece, having found false condition in main IF it skipped all other ELSE clauses and proceeded to the next loop iteration.
--- End quote ---
The script engine simple.. it is line based.. it is explained somewhere..
So do not compress rows
doing
--- Code: ---{ $var = 33;
--- End code ---
might fail. ( I think , did not test)
instead do
--- Code: ---{
$var = 3;
--- End code ---
--- Quote from: Suncatcher on February 17, 2016, 21:44:28 ---3. The collation of the real directories differs from the collation of array that FindFiles() function returns as result (see picture 2). And that's awkward.
--- End quote ---
the script call do not sort it, It returns as Windows returns it. The view is sorted depending on your settings
--- Quote from: Suncatcher on February 17, 2016, 21:44:28 ---4. The arrays cannot be initialized as empty ones. E.g.
--- Code: ---@var $arr = {};
--- End code ---
Even if you write like this it inserts empty array member.
--- End quote ---
If empty there is no need to init it. But will check.
--- Quote from: Suncatcher on February 17, 2016, 21:44:28 ---5. The arrays cannot be initialized with variables. E.g.
--- Code: ---@var $arr = {$ini[$n], $ini[$n+1], $ini[$n+2], ...};
--- End code ---
Only with literals and it's poor.
--- End quote ---
Now you are just trying to break it.
Avoid exotic syntaxes, Don't do to much at once.. MultiScript engine support a lot but it is still a very simple script engine.
--- Quote from: Suncatcher on February 17, 2016, 21:44:28 ---So, the script language, as well as debugger, is still very raw for real work. IMHO.
--- End quote ---
It is meant for small script. Not for large applications/tools. There are a real API for that..
I got some large advanced script my self.. So I use it for real work. So it is good enough for that. could it be better ? Ofcouse. And it will be .. If time allows..
Suncatcher:
Nevertheless, thank you for your job! :) I just wanted to highlight ways of improvement, not to abuse.
The Commander itself is above all praise.
Mathias (Author):
I do not like to add stuff just because it would be nice to have.
There must be a real need. I have limited time so I need to prioritize things that are really needed.
So if you find something that you really need, like a script function that does X, Then I might add it.
Navigation
[0] Message Index
[*] Previous page
Go to full version