Skip to content

Instantly share code, notes, and snippets.

View tablacus's full-sized avatar

Gaku tablacus

View GitHub Profile
@tablacus
tablacus / EnableShellExecuteHooks.js
Created August 4, 2017 14:20
EnableShellExecuteHooks "on" with Tablacus Explorer Add-on Shell execute hook 1.02 or higher.
var ex = { EnableShellExecuteHooks: true, Explorer: true };
OpenNewProcess("addons\\shellexecutehook\\worker.js", ex, false, WINVER >= 0x600 ? "RunAs" : null);
@tablacus
tablacus / DisableShellExecuteHooks.js
Last active August 28, 2017 12:36
EnableShellExecuteHooks "off" with Tablacus Explorer Add-on Shell execute hook 1.02 or higher.
var ex = { EnableShellExecuteHooks: false, Explorer: false };
OpenNewProcess("addons\\shellexecutehook\\worker.js", ex, false, WINVER >= 0x600 ? "RunAs" : null);
@tablacus
tablacus / ToggleShellExecuteHooks.js
Last active April 7, 2022 18:14
EnableShellExecuteHooks "toggle" with Tablacus Explorer Add-on Shell execute hook 1.02 or higher.
var toggle;
try {
  toggle = !wsh.RegRead("HKCU\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer\\EnableShellExecuteHooks");
} catch (e) {
  toggle = true;
}
var ex = { EnableShellExecuteHooks: toggle, Explorer: true };
OpenNewProcess("addons\\shellexecutehook\\worker.js", ex, false, WINVER >= 0x600 ? "RunAs" : null);
@tablacus
tablacus / openselectednextpane.js
Last active September 8, 2021 10:52
Open selected items in next pane. (Require an add-on "Switch to next pane") - Tablacus Explorer
let FV = GetFolderView(Ctrl, pt);
const Selected = FV.SelectedItems();
if (Selected.Count) {
FV = Sync.SwitchPane.NextFV(FV);
for (let i = 0; i < Selected.Count; i++) {
NavigateFV(FV, Selected.Item(i), SBSP_NEWBROWSER);
}
}
@tablacus
tablacus / RefreshKeepSelected.js
Last active August 8, 2017 14:55
Refresh (Keep selected) - Tablacus Explorer
var FV = GetFolderView(Ctrl, pt);
var Selected = FV.SelectedItems();
FV.Refresh();
if (Selected && Selected.Count) {
for (var i = Selected.Count; i--;) {
FV.SelectItem(Selected.Item(i), SVSI_SELECT);
}
FV.SelectItem(Selected.Item(0), SVSI_SELECT | SVSI_FOCUSED);
}
@tablacus
tablacus / CopyCurrentFolderAsText.js
Last active May 12, 2020 06:01
Copy current folder as text - Tablacus Explorer
clipboardData.setData("text", FV.FolderItem.Path);
@tablacus
tablacus / OpenClipboardPath.js
Last active May 26, 2023 04:26
Open clipboard path in new tab - Tablacus Explorer
var Items = api.OleGetClipboard();
if (Items.Count) {
for (var i = 0; i < Items.Count; i++) {
Navigate(Items.Item(i), SBSP_NEWBROWSER);
}
return;
}
Items = String(clipboardData.getData("text")).split(/[\r\n]+/);
for (var i in Items) {
if (/^"?[A-Z]:\\|^"?\\\\[A-Z]|^"?::{/i.test(Items[i])) {
@tablacus
tablacus / ResetTreeView.js
Last active September 23, 2020 14:08
Reset tree view
var FV = GetFolderView(Ctrl, pt);
if (FV) {
var TV = FV.TreeView;
if (TV) {
var hwnd = TV.hwndTree;
for (var hItem = api.SendMessage(hwnd, TVM_GETNEXTITEM, 0, null); hItem; hItem = api.SendMessage(hwnd, TVM_GETNEXTITEM, 1, hItem)) {
api.SendMessage(hwnd, TVM_EXPAND, 0x8001, hItem);
}
TV.Expand(FV.FolderItem, 0);
}
var FV = GetFolderView(Ctrl, pt);
if (FV) {
var hMenu = api.CreatePopupMenu(), hSubMenu;
var ContextMenu = FV.ViewMenu();
if (ContextMenu) {
ContextMenu.QueryContextMenu(hMenu, 0, 1, 0x7fff, CMF_DEFAULTONLY);
var mii = api.Memory("MENUITEMINFO");
mii.cbSize = mii.Size;
mii.fMask = MIIM_SUBMENU;
for (var i = 0; i < api.GetMenuItemCount(hMenu); i++) {
var FV = GetFolderView(Ctrl, pt);
if (FV) {
var hMenu = api.CreatePopupMenu(), hSubMenu;
var ContextMenu = FV.ViewMenu();
if (ContextMenu) {
ContextMenu.QueryContextMenu(hMenu, 0, 1, 0x7fff, CMF_DEFAULTONLY);
var mii = api.Memory("MENUITEMINFO");
mii.cbSize = mii.Size;
mii.fMask = MIIM_SUBMENU;
for (var i = 0; i < api.GetMenuItemCount(hMenu); i++) {