Skip to content

Instantly share code, notes, and snippets.

Avatar

Gaku tablacus

View GitHub Profile
@tablacus
tablacus / selecttotop.js
Last active Mar 21, 2021
All selected items on top of the list - Tablacus Explorer
View selecttotop.js
const FV = GetFolderView(Ctrl, pt);
const Selected = FV.Items(SVGIO_SELECTION | SVGIO_FLAG_VIEWORDER);
const Progress = api.CreateObject("ProgressDialog");
Progress.StartProgressDialog(te.hwnd, null, 2);
const Name = GetText("Selected items");
try {
FV.SelectItem(null, SVSI_DESELECTOTHERS);
const IconSize = FV.IconSize;
const ViewMode = api.SendMessage(FV.hwndList, LVM_GETVIEW, 0, 0);
if (ViewMode == 1 || ViewMode == 3) {
@tablacus
tablacus / openInOtherPane.js
Created Feb 23, 2021
The same folder to open in the other pane. (* Add-on "Switch to next pane" is required.)
View openInOtherPane.js
const FV = GetFolderView(Ctrl, pt);
NavigateFV(Sync.SwitchPane.NextFV(FV), FV, SBSP_SAMEBROWSER);
@tablacus
tablacus / activatecolor.js
Created Aug 20, 2020
Change toolbar background color on activation/deactivation - Tablacus Explorer
View activatecolor.js
AddEvent("SystemMessage", function (Ctrl, hwnd, msg, wParam, lParam) {
if (msg == WM_ACTIVATE) {
document.body.style.backgroundColor = wParam ? "#F0F0F0" : "#757575";
}
});
@tablacus
tablacus / autoarrangeonrename.js
Last active Aug 17, 2020
Auto arrange on rename - Tablacus Explorer
View autoarrangeonrename.js
AddEvent("ChangeNotify", function (Ctrl, pidls, wParam, lParam) {
if (pidls.lEvent & (SHCNE_RENAMEITEM | SHCNE_RENAMEFOLDER)) {
var pid = api.ILGetParent(pidls[1]);
api.SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_IDLIST, pid, null);
var FV = GetFolderView();
if (FV && api.ILIsEqual(FV, pid)) {
if (FV.ItemCount(SVGIO_SELECTION) == 1) {
setTimeout(function() {
var Selected = FV.SelectedItems();
if (api.ILIsEqual(Selected.Item(0), pidls[1])) {
@tablacus
tablacus / decBadges.js
Created Aug 15, 2020
Decrement badges - Tablacus Explorer
View decBadges.js
var Selected = GetSelectedArray(Ctrl, pt, true).shift();
if (Selected && Selected.Count) {
for (var i = Selected.Count; i-- > 0;) {
var path = api.GetDisplayNameOf(Selected.Item(i), SHGDN_FORADDRESSBAR | SHGDN_FORPARSING | SHGDN_ORIGINAL);
var s = api.LowPart(Addons.Badge.DB.Get(path)) - 1;
if (s >= 0) {
Addons.Badge.Set(path, s);
}
}
}
@tablacus
tablacus / incbadges.js
Created Aug 15, 2020
Increment badges - Tablacus Explorer
View incbadges.js
var Selected = GetSelectedArray(Ctrl, pt, true).shift();
if (Selected && Selected.Count) {
for (var i = Selected.Count; i-- > 0;) {
var path = api.GetDisplayNameOf(Selected.Item(i), SHGDN_FORADDRESSBAR | SHGDN_FORPARSING | SHGDN_ORIGINAL);
var s = api.LowPart(Addons.Badge.DB.Get(path)) + 1;
if (s < 6) {
Addons.Badge.Set(path, s);
}
}
}
@tablacus
tablacus / locked.css
Created Jul 16, 2020
Locked tab style sheet
View locked.css
.locked {
background-color: #ffff00;
}
@tablacus
tablacus / datecolumntoascending.js
Created Jul 12, 2020
Click the date modified column to sort in ascending order
View datecolumntoascending.js
AddEvent("ColumnClick", function (Ctrl, iItem) {
var cColumns = api.CommandLineToArgv(Ctrl.Columns(1));
var s = cColumns[iItem * 2];
if (s == "System.DateModified" && Ctrl.SortColumn(1) !== "System.DateModified" && api.GetKeyState(VK_SHIFT) >= 0) {
Ctrl.SortColumn = "System.DateModified";
return S_OK;
}
});
@tablacus
tablacus / up.js
Created May 23, 2020
Go up - Tablacus Explorer
View up.js
FV = GetFolderView(Ctrl, pt);
FV.Navigate(null, SBSP_PARENT);
@tablacus
tablacus / focustreeview.js
Created Dec 24, 2019
Focus tree view - Tablacus Explorer
View focustreeview.js
FV.TreeView.Focus();
return S_OK;