it would help if i could see the source dir format window data or at least a few line of it. Is it....
/foldername/foldername/
or
foldername/foldername
or
/foldername/foldername
This would help me see if there was any way to restructure the routine for faster speed.
Also Im not sure if %root is ment to be zero to being with or not, it could have been a set u used elsewhere, i didnt really look into it as with no source dir data its hard to follow the scripts order of execution.
heres some things that may speed it up slightly
var %temp = $left(%line,$pos(%line,$chr(92),%i))
replace with
var %temp = $gettok(%line,1-%i,92) $+ \
(this might not be any faster honestly, and only works if the source dir's were not in the format \foldername...., this might be your reason for using $left instead of $gettok, im not sure)
$gettok(%temp,$numtok(%temp,92),92)
replace with
$gettok(%temp,-1,92)
(this should be ok regardless of source dir format)
if (%i != 1) var %treeline = %treeline $calc($hget(MTlistview,%temp2) - 1)
replace with
if (%i != 1) %treeline = %treeline $calc($hget(MTlistview,%temp2) - 1)
the VAR statment isnt needed and can add 20% time to processing the result into the value
Try this, it may help...
dialog -t treetest %title LOADING ( $+ $int($calc(%j / %numlines * 100)) $+ % $+ )
replace with
%p = $int($calc(%j / %numlines * 100)
if (%p != %p.v) {
%p.v = %p
dialog -t treetest %title LOADING ( $+ %p.v $+ % $+ )
}
The above well only send a new percentage out when ever the percentage changes, i have found in every program i have ever written in any language, a huge overhead in loops is the nice little display your putting on telling how far along you are, dump it or minimize it, and its usally faster, even if your code is more, you well have to try it to see. I would dump it alltogether, just tell em to stand by!
on this one above remeber to define the %p & %p.v as VAR at the top of the script
And on defining VAR you should define the whole lot at the start outside any loop, and then just use the variable name, as i said above var produces a 20% overhead when assigning values to existing varaibles.
heres something to check on
/did -h hide id
now i dont know about mirc but i know other apps work alot faster if u hide the item your altering, then display it at the end. I havent done stuff all with dialogs so i cant tell you if this works or is even the right command to do it.
on a precoutionary note, i would change these $replaces from using $chr(95) to using the ? character since 95 _ is a legit foldername character, and shouldnt be used a a space holder, since THIS_FOLDER_NAME well become THIS FOLDER NAME and THIS FOLDER_NAME well also become THIS FOLDER NAME, ? is not a legal character in foldernames so is a good as any place holder
I might be able to look at reworking the way you build your data, but without source data as an example its a bit hard to follow whats ment to happen.