Skip to content

Instantly share code, notes, and snippets.

@tablacus
Created December 18, 2021 13:59
Show Gist options
  • Select an option

  • Save tablacus/cc9562cb20e0d31bdb7ce41a57f91a58 to your computer and use it in GitHub Desktop.

Select an option

Save tablacus/cc9562cb20e0d31bdb7ce41a57f91a58 to your computer and use it in GitHub Desktop.
Toggle selection with inline renaming - Tablacus Explorer
const hEdit = api.SendMessage(FV.hwndList, LVM_GETEDITCONTROL, 0, 0);
const fn = api.GetWindowText(hEdit);
let start = api.SendMessage(hEdit, 0xB0, 0, 0);//EM_GETSEL
const end = Math.floor(start >> 16);
start &= 0xffff;
if (fn.indexOf(".") >= 0) {
if (start) {
api.SendMessage(hEdit, 0xB1, 0, fn.length);//EM_SETSEL
} else {
if (end == fn.length) {
api.SendMessage(hEdit, 0xB1, 0, fso.GetBaseName(fn).length);//EM_SETSEL
} else {
api.SendMessage(hEdit, 0xB1, fn.length - fso.GetExtensionName(fn).length, fn.length);//EM_SETSEL
}
}
} else {
api.SendMessage(hEdit, 0xB1, 0, start == end ? fn.length : 0);//EM_SETSEL
}
@tablacus
Copy link
Author

Add-on : Key
Location: Edit

image

@kettenfett
Copy link

If you don't know what this does:

It switches from name to extension to name+extension upon each press of "F2" (Rename-Shortcut).

Example Video:
https://user-images.githubusercontent.com/23098362/148750909-90adbd05-5f43-4eda-8f0e-10e13f5eafec.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment