Yes, the method I had used in a few scripts calls for reading ini file and looping through the toolbar() to get a name match. You may not like these self-modifying scripts, but in this case, it's only performing the quick update of the index number and it's very fast even on the first run and after that, it's skipped. It was probably you or highend that I got a variation of this code.
Code: Select all
$ctbindex = "unknown";
$toolbar = toolbar();
$self = self("file");
//*** Determine & set CTB index [$ctbindex above] based on CTB name
if($ctbindex LikeI "unknown") {
$name_CTB = ctbname();
foreach($button, $toolbar, ",") {
if(substr($button, 0, 3) LikeI "ctb") {
$ctbI = trim($button, "ctb", "L");
if(ctbname( , $ctbI) == "$name_CTB") {
$ctbindex = $ctbI; break;
}
}
}
$content = replace(readfile($self), "unknown", "$ctbindex", , 1, 1);
// or use $content = regexreplace(readfile($self), "(\$[c]tbindex\s?=\s?"")([^""]+)(.*)", "$1$ctbindex$3");
writefile($self, $content);
}
Personally, I don't think I'd want the script to activate a thumbnail view if it wasn't already in one. There may be too many situations where you inadvertently press the CTB or CKS and not be in a folder that has images type files you want to see in a thumbnail view. So you end up getting XY generating unnecessary thumbnails.
Thanks.
XYplorer Beta Club