Skip to content

Instantly share code, notes, and snippets.

@tablacus
Last active August 17, 2020 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tablacus/86679075c7c398e22d54955e2f6f29dd to your computer and use it in GitHub Desktop.
Save tablacus/86679075c7c398e22d54955e2f6f29dd to your computer and use it in GitHub Desktop.
Auto arrange on rename - Tablacus Explorer
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])) {
FV.SelectItem(pidls[1], SVSI_SELECT | SVSI_FOCUSED | SVSI_ENSUREVISIBLE | SVSI_NOTAKEFOCUS);
}
}, 99);
}
}
}
});
@tablacus
Copy link
Author

tablacus commented Aug 16, 2020

This is used in an add-on "Run at setup".
image

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