How to jump/scroll ↓↑X lines with a keyboard command?

I'd like to be able to use single alpha keys to:

  • scroll down (without changing any selection/keyboard focus, so just like with a mouse scroll wheel). I'm have a two-key shortcut bound outside of DOpus to send scroll events, but I can't make those single key as I'd need to know whether I'm inside a lister without any text field activated and not, say, nagivating a toolbar menu
  • jump down by X lines (for 1 line I use Select NEXT and Select NEXT=nodeselect with ) (see partial solution Jump Up/Down by a given number of items)

(I have a vague recollection that there might've been a similar post, but couldn't find anything, this is similar to the second item, but without a solution Suggestion: Ctrl+up/downarrow scroll the lister - #3 by KrisBlueNZ)

One scripting way to solve the first issue would be something like

var sh = new ActiveXObject("WScript.Shell");
for (var i = 0; i < 10; i++) {
  sh.SendKeys("{DOWN}");
}

But then I'd like the jump to be instant, so I guess the proper way would be to find the current item's index and select Index+10's item if it exists, but then how do I get the index of the currently focused item? (I found DOpus.listers.lastactive.activetab.GetFocusItem(); (ignoring error handling), what next?)

And I don't know a way for mouse scrolls, only references I've found were for the image viewer

SelectNext does something similar. Shouldn't be too difficult to modify for your needs.

https://resource.dopus.com/t/selectnext-select-the-next-n-items/43827

1 Like

I've partially solved the first issue, although the command is slow in huge folders with many items (precisely where this command is most needed :frowning:), and it doesn't seem to be due to enumeration since it's slow even at the beginning of a folder when only a few items are enumerated to find the target item's index. And at the end of the folder the speed doesn't seem materially worse

JumpItem↕ By=5 jump down 5 lines
JumpItem↕ By=5 NODESELECT SELECT same, but also select those lines and do not deselect existing selections
(-5 would be jump up)

see updated script here Jump Up/Down by a given number of items