GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Command: GoRefreshKeepSelection (refresh & keep selected)

GoRefreshKeepSelection - A script command that refreshs tabs and tree content, while keeping the current selection and also scrolling back to the selected items (can be disabled).

################################################################
THIS SCRIPT ADDIN IS OUTDATED, please use "GoEx":
Command: GoEx (extended Go command functionality)?
################################################################


Description:
I made this to refresh a tab and maintain my selection, because I don't like to lose my selection on refreshs (DO default), simple as that! o)

Params / ScriptConfigs and Features:

  • DebugOutput, switch to enable printing of details for troubleshooting
  • NoScrollToSelection, switch to disable scrolling to selected items
  • ScrollToChecked, switch to priorize checked items when scrolling back to selection
  • GoRefreshOptions, any valid option for "Go REFRESH"
  • GoParams, any additional switch or parameter for the "Go" command

Usage:
The usage is quite similar to that of the native "Go REFRESH" functionality.

Native command:
Go REFRESH

Script command:
GoRefreshKeepSelection

If you'd like to keep selection while refreshing both file displays of a dual lister and also refresh the thumbnails:

Native command:
Go REFRESH=both REFRESHTHUMBNAILS

Script command:
GoRefreshKeepSelection GOREFRESHOPTIONS=both GOPARAMS=REFRESHTHUMBNAILS

If you'd like to refresh the right file display only:

Native command:
Go REFRESH=right

Script command:
GoRefreshKeepSelection GOREFRESHOPTIONS=right

Got it? o)


Installation:
To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.
After that, you should edit your "F5" hotkey to run "GoRefreshKeepSelection" instead of "Go REFRESH".


Download:

Many thanks for providing this really useful script.

Feature Request:

  • When changing the Refresh command to Go Refresh=both (or dest or all) the selection in destination should also be kept.

Hallo Kundal! o)

I guess I see the reason for your request, but I think you can just run the command twice, whereever you change the default refresh command for GoRefreshKeepSelection to "Go REFRESH=both", or am I wrong?

Thanks for dropping in! o)

EDIT: Oh, I just noticed, "Go REFRESH=dest" is not yet working as it should, so my idea to run it twice won't work. I'll see what I can do about it.

Hi tbone,
I modified your script and got it working for Go REFRESH=all , both and dest (checkbox mode not tested).

Edit: attached script removed

Updated to v0.2

  • major improvements to fully support all "Go REFRESH" options and additional "Go" switches and parameters
  • attention: changes in parameter names, config items and maybe general handling
  • updated the "Usage" section to reflect all changes

@kundal
Thanks for your help! o) But please remove your version. o) It errors for single listers and generally cannot work satisfyingly.
A more generic approach is needed to really take care of selections, checkbox mode and additional refresh options.

I also noticed a possible DO "issue" with Tab.Update(). It seems the method does not update the tab object synchroniously.
So a special handling (looping while updating the tab) is needed to get the script to sync with the GUI again.

Many thanks for the now full-featured script. Works great.

Done.
I know it was a really dirty thing but it worked (maybe only) for my standard usecase: dualpane - no checkbox - refresh all.
I'm far away from your knowledge about scripting and studying/hacking your scripts is always a great challenge and fun for me. :smiley:

I'm glad to hear! o) Time will tell if it really works stable and covers all use cases, let's hope the best.
The fun is also on my side, so I hope to read you soon - in the GoRegistry thread maybe? o)

Most certainly. Can't wait for the new version...

Hello tbone,

great Script. Thank you for sharing.
One Question please. Is there a way to use this Script in Flat View Mode?

Excuse my insufficient English skills, please.

Thanks
Lezgus

Should work fine in flatview mode, it does so for me at least.

Hello tbone,

you are right. Sorry my mistake.
It's was an "error" in combine with an other script.

Thank you
Lezgus

After a refresh is done,the first file in the lister is also getting selected including the one on which selection is already there,will u pls correct it

You may just need to turn off Preferences / File Displays / Options / Automatically select first file in folder (except in Power Mode).

I want the above setting to work with refresh,i use it.

Maybe try GoEx, find it here. It is a newer and extended version of what this script addin here provides:

@carter
I just tried the native Go REFRESH command, it also selects the first item (if enabled in the prefs), so my impression is, this is something only Jon and Leo could work on, maybe the auto selection could be skipped upon refresh or whenever some kind of "NOFIRSTITEMSEL" switch is passed to the Go command.