Re: Expandable drive button
Posted: 17 Nov 2013 19:01
It would be nice if you could customize the button to include whatever you want ?
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
Hi, sorry I don't quite understand my scripting in XY is still weakklownboy wrote:Actually you can. Please refer this post within this thread... http://www.xyplorer.com/xyfc/viewtopic. ... =30#p92968
Code: Select all
$newtoolbar=replace($toolbar,"$curctb,","$curctb,{drives_fix},-,") ; Code: Select all
$newtoolbar=replace($toolbar,"$curctb,","$curctb,{drives_fix},-") ; Code: Select all
//Expandable Drive Button -v2.4
/*This script expands the Custom Toolbar Button (CTB) to show button fixed drives to it's right.
The CTB can be collapsed manually or automatically (see settings)
How to use it:
1) Save the script as XY script file and put it in XY's script folder.
2) Make a new CTB and note it's index and change it in the script below.
3) Enter load "ExpandButton.xys"; in the CTB's "On click:" field.
*/
perm $p_ctbindex, $p_officon, $p_onicon;
//Settings (tagged with ###)
//###
//(1) CTB index: change the below "$p_ctbindex" to the index of your ctb10 to ctb3+
$p_ctbindex="15";
//###
//(2) Autocollapse options: change $collapse to one of the following-
// a) 0 = Manual collapse
// b) -1 = Default: Auto-collapse button when clicking on list (or catalog or addressbar)
// c) Any positive number = seconds to wait before collapsing button
$collapse=0;
//###
//(3) CTB icons: use either in-built XY icon (":drives")or your own (eg:"drive.ico")
$p_officon=":tabsets"; //collapsed icon :visualfilter
$p_onicon=":tabsets"; //expanded icon
$curctb="ctb$p_ctbindex";
$toolbar=toolbar();
if (ctbstate(,$p_ctbindex) == 0) {
sub "_PVCheck";
perm $p_toolbar;
$p_toolbar=$toolbar;
if(ctbicon(,$p_ctbindex)==""){
ctbicon("$p_officon",$p_ctbindex);
}
ctbicon("$p_onicon",$p_ctbindex);
ctbstate(1,$p_ctbindex);
$newtoolbar=replace($toolbar,"$curctb","tsf,visualfilter,ctb31,cofi,icf,showfolders,rename,$curctb") ;
toolbar($newtoolbar);
if($collapse=="0") {
end(1==1);
}
elseif($collapse=="-1"){
run "cmd /c cd /d <xypath> & xyplorer.exe /script=""::load 'ExpandButton.xys','_AutoCollapse'"" /flg=2 /hwnd=<hwnd>", , 0,0;
end(1==1);
}
else{
run "cmd /c ping -n $collapse 127.0.0.1 >nul & cd /d <xypath> & xyplorer.exe /script=""::load 'ExpandButton.xys','_WaitCollapse'"" /flg=2 /hwnd=<hwnd>", , 0,0;
}
}
else {
ctbicon("$p_officon",$p_ctbindex);
ctbstate(0,$p_ctbindex);
$oldtoolbar=replace($toolbar,"tsf,visualfilter,ctb31,cofi,icf,showfolders,rename,$curctb,","$curctb,");
toolbar($oldtoolbar);
unset $p_ctbindex, $p_officon, $p_onicon;
end(1==1);
}
"_PVCheck"
$PV_ON=getkey("ScriptRetainPVs", "Settings");
if($PV_ON==1){
//nothing
}
else{
$confirm= confirm ("To make this script work accross sessions, please check: <br>'Remember Permanent Variables' from <br>Tools | Configuration| Refresh, Icons, History - Scripting <br>Go to configuration now? <br>OK=Yes Cancel=No");
if ($confirm==1){
#600;
savesettings;
}
}
"_WaitCollapse"
ctbicon("$p_officon",$p_ctbindex);
ctbstate(0,$p_ctbindex);
toolbar($p_toolbar);
unset $p_ctbindex, $p_officon, $p_onicon;
"_AutoCollapse"
focus "T";
while("<get FocusedControl>"=="T"){
wait(100);
//Stay in loop if focus is on address bar
//Break out of loop if focus on list, tree or catalog
}
ctbicon("$p_officon",$p_ctbindex);
ctbstate(0,$p_ctbindex);
toolbar($p_toolbar);
unset $p_ctbindex, $p_officon, $p_onicon;
Code: Select all
$newtoolbar=replace($toolbar,"$curctb","$curctb,$added_CTBs,-,"); toolbar($newtoolbar);that's real interesting!klownboy wrote:There have been numerous changes in XYplorer for options on clicking/triggering a CTB. So when I get a chance and some ambition, I'll update this script in an additional revision. Like for example, I had to resort to using drag and drop on to the CTB to trigger a reset , now I could simply have the user have the ctrl/shift buttons held down when he clicks the CTB. Or I could have a set of additional buttons expand out when the shift button is held down when clicking the CTB.