Selections - save/restore selections

Discuss and share scripts and script files...
Post Reply
bdeshi
Posts: 4249
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Selections - save/restore selections

Post by bdeshi »

One functionality -- save and load selections.
Selections: the main menu
Selections: the main menu
selections-script.png (4.45 KiB) Viewed 1170 times
== FEATURES ==
  • Selections can be saved with an optional label.
  • Selections can be saved with path, such selections are applicable only while that path is open.
  • Selections can alternatively be saved with item names only. Such selections are applicable anywhere.
  • The load menu lists selections applicable to current location, plus names-only selections. Labelled selections are listed first.
  • The manager menu allows for deletion, manual editing and relabelling of selections.
== INSTALL ==
  • Selections.xys
    release 1.0
    (11.89 KiB) Downloaded 146 times
  • Just download the script and run it.
== USAGE ==
  • Running the script without arguments shows the main script menu. So you can simply attach the script to a catalog or UDC item just as:

    Code: Select all

    ::load '<xyscripts>\selections.xys';
  • Four "public" subscripts are provided: savename, savepath, load, manage.
    These can be used to access specific individual functionality as needed, such as for use with custom buttons. Here's a demo CTB snippet that saves selection on left-click and lists loadable selections on right-click:

    Code: Select all

    Snip: CTB 1
      XYplorer 18.50.0300, 12/8/2017 5:00:11 PM
    Action
      NewUserButton
    Name
      Selections
    Icon
      gentleface\round_checkmark.ico
    ScriptL
      load "selections";
    ScriptR
      load "selections", 'load';
    FireClick
      0
    [/size]
== CONFIG ==
  • One configurable permanent variable is created:$P_SELECTIONS_INI, which points to the script's configuration file. (<xydata>\Selections\Selections.ini by default.) Selections are saved at the same location as this ini.
    In other words, all selections and configuration are saved inside <xydata>\Selections by default.
== NOTES ==
  • Saving as Names-only selection is recommended.
  • Path selections are saved with absolute paths. In fact, the path is taken from tab('get', 'term') so relative and variable paths are possible, but these selections will only be active with the exact same tab term.
  • The code is a mess. You have been warned notified.


Happy selections! Don't forget to report bugs! :cup: :cup:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply