Skip to content

Instantly share code, notes, and snippets.

@tablacus
Last active March 21, 2021 13:27
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/449b7f93415c9e2a646b50d75383d5bd to your computer and use it in GitHub Desktop.
Save tablacus/449b7f93415c9e2a646b50d75383d5bd to your computer and use it in GitHub Desktop.
All selected items on top of the list - Tablacus Explorer
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) {
api.SendMessage(FV.hwndList, LVM_SETVIEW, 4, 0);
}
const FolderFlags = FV.FolderFlags;
FV.FolderFlags = FolderFlags | FWF_AUTOARRANGE;
FV.GroupBy = "System.Null";
const pt2 = api.Memory("POINT");
FV.GetItemPosition(FV.Item(0), pt2);
const nMax = Selected.Count;
Progress.SetLine(1, api.LoadString(hShell32, 50690) + " " + Name, true);
for (let i = 0; !Progress.HasUserCancelled(i, nMax, 2) && i < nMax; ++i) {
FV.SelectAndPositionItem(Selected.Item(nMax - i - 1), SVSI_DESELECT, pt2);
}
FV.SelectItem(Selected, SVSI_SELECT | SVSI_FOCUSED);
api.SendMessage(FV.hwndList, LVM_SETVIEW, ViewMode, 0);
FV.FolderFlags = FolderFlags;
FV.IconSize = IconSize;
} catch (e) { }
Progress.StopProgressDialog();
@tablacus
Copy link
Author

tablacus commented Mar 17, 2021

image

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