Skip to content

JScript: .SelectedItems() returns null in dual pane (can't copy selected items via script) #838

@francois113

Description

@francois113

Hi Gaku,

I'm trying to create a JScript keyboard shortcut in Tablacus Explorer to copy selected files from the active pane to the other pane in dual-pane mode.

Despite all configurations being correct, .SelectedItems() often returns null, or accessing .Count fails with TypeError. Here's what I verified:


✅ Environment

  • Tablacus Explorer v25.5.13

  • Windows 11 Pro 24H2 (10.0.26100)

  • Admin: ✅

  • WebView2: ✅

  • Dual pane active (verified via te.Ctrls(CTRL_FV).length === 2)

  • Installed Add-ons:
    aboutblank 1.04
    addressbar 1.79
    back 1.18
    darkmode 1.19
    download 1.08
    extract 1.15
    filterbar 1.40
    forward 1.18
    innerbreadcrumbsaddressbar 1.55
    inputcontextmenu 1,01
    key 1.26
    mainmenu 1.16
    mouse 1.33
    multithread 1.29
    remember folder view settings 1.42
    segoeicons 1.04
    statusbar 1.20
    systemfolder 1.12
    tabplus 1.97
    titlebar 1.09
    toolbar 1.44
    treeview 1.48
    undoclosetab 1.18
    up 1.20

  • Scripting mode: JScript


🔧 Goal

Copy selected file(s) from the active pane to the inactive pane via shortcut Ctrl+→

🔁 What works

  • Shortcuts are correctly triggered (tested via alert() and logging)
  • te.Ctrl(CTRL_FV) and te.Ctrl(CTRL_FV | CTRL_NEXT) both return valid folder views
  • Logging to D:\TmpFiles\temp.txt works
  • Paths of both panes are valid and different
  • One file is selected in active pane

❌ What fails

var FV = te.Ctrl(CTRL_FV);
var FV2 = te.Ctrl(CTRL_FV | CTRL_NEXT);
var Items = FV.SelectedItems(); // ← often null or fails

log.WriteLine("Items.Count: " + Items.Count);  // Causes TypeError

Error:

TypeError: Unable to get property 'Count' of undefined or null reference

🧪 Sample script that logs but fails to get selected items

var fso = new ActiveXObject("Scripting.FileSystemObject");
var log = fso.OpenTextFile("D:\TmpFiles\temp.txt", 8, true);
var runCount = 28;
log.WriteLine("========== Run #: " + runCount + " ==========");

var FV_active = te.Ctrl(CTRL_FV);
var FV_other = te.Ctrl(CTRL_FV | CTRL_NEXT);

if (!FV_active || !FV_other || FV_active == FV_other) {
    log.WriteLine("Invalid folder views or same pane.");
    log.Close();
    return;
}

log.WriteLine("Source (active) pane: " + FV_active.FolderItem.Path);
log.WriteLine("Target (other) pane: " + FV_other.FolderItem.Path);

var Items = FV_active.SelectedItems();
if (!Items || typeof Items.Count !== "number" || Items.Count === 0) {
    log.WriteLine("❌ No valid items selected, or failed to get Items.");
    log.Close();
    return;
}

var destPath = FV_other.FolderItem.Path;
log.WriteLine("Copying selected item(s): " + Items.Count);

for (var i = 0; i < Items.Count; i++) {
    var item = Items.Item(i);
    var srcPath = item.Path;
    var fileName = fso.GetFileName(srcPath);
    var dest = fso.BuildPath(destPath, fileName);

    log.WriteLine("  Item[" + i + "]: " + srcPath);
    log.WriteLine("    IsFolder: " + item.IsFolder);
    log.WriteLine("    Dest path: " + dest);

    try {
        if (item.IsFolder) {
            fso.CopyFolder(srcPath, dest, true);
            log.WriteLine("    ✔ Folder copied.");
        } else {
            fso.CopyFile(srcPath, dest, true);
            log.WriteLine("    ✔ File copied.");
        }
    } catch (copyErr) {
        log.WriteLine("    ✖ FAILED: " + copyErr.message);
    }
}

log.Close();

✅ What would help

Can you confirm:

  • Whether .SelectedItems() works in JScript in dual-pane setups?
  • Is there a preferred way to reference selected files across panes reliably?
  • Is there a known add-on dependency to make .SelectedItems() reliable?

Thanks again for this brilliant file manager — it’s been fantastic for years.

Best Regards,
François / France

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions