SC: Favs() - Set or retrieve favorites lists.

Features wanted...
Post Reply
TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

SC: Favs() - Set or retrieve favorites lists.

Post by TheQwerty »

favs()
Sets or retrieves a Favorites list.

Syntax

Code: Select all

favs(type=(d|f), [items], [separator=CRLF], [action=a|p|s|d)
  • type [required]
    Specifies which favorites list.
    • d = Folders/Directories
    • f = Files
  • items [optional]
    Favorite items separated by separator.
    If missing the function just returns the current favorites of specified type.
  • separator [optional]
    Separator for list of items.
    Defaults to CRLF (line feed).
    Notes: CRLF chosen over pipe ('|') since items may contain visual filters or script.
  • action [optional]
    Action to take with the items.
    • a = Append to current list. (default)
    • p = Prepend to current list.
    • s = Set/Replace current list.
    • d = Delete from current list.
return - The list of current favorites for the specified type.

Examples

Code: Select all

text favs('f'); // return the current list of favorite files
favs('d', <curpath>); // add current path to favorite folders
favs('d', <curpath>,, 'd'); // remove current path from favorite folders
favs('f', <focitem>,, 'p'); // add focused item to top of favorite files
paperfolder('Favorites', favs('f') . <crlf> . favs('d')); // save favorite files and folders to a 'Favorites' paper folder
Change log:

Code: Select all

    + Scripting got a new function.
      Name: favs
      Action: Set or retrieve a Favorites list.
      Syntax: favs(type=(d|f), [items], [separator=CRLF], [action=a|p|s|d)
        type: [required] Specifies which favorites list.
              d = Folders/Directories
              f = Files
        items: [optional] Favorite items separated by separator.
               If missing the function just returns the current favorites.
        separator: [optional] Separator for list of items.
                  Defaults to CRLF (line feed)
        action: [optional] Action to take with the items.
                a = Append to current list. (Default)
                p = Prepend to current list.
                s = Set/Replace current list.
                d = Delete from current list.
      return: The list of current favorites for the specified type.

      Examples:
        text favs('f'); // return the current list of favorite files
        favs('d', <curpath>); // add current path to favorite folders
        favs('d', <curpath>,, 'd'); // remove current path from favorite folders
        favs('f', <focitem>,, 'p'); // add focused item to top of favorite files
        paperfolder('Favorites', favs('f') . <crlf> . favs('d'));
        // save favorite files and folders to a 'Favorites' paper folder

:whistle: :wink:

klownboy
Posts: 4109
Joined: 28 Feb 2012 19:27

Re: SC: Favs() - Set or retrieve favorites lists.

Post by klownboy »

Sounds interesting as well as useful. So theoretically with this SC Favs(), we would be able to add an executable file(s) to the list of Favorite Files or change the list depending on the circumstances and then immediately run Favorite File submenu (CID #564) all on the fly in a script. Would the result of running favs('f'); be equivalent to running #564? [Edit: I suppose not, it would return the separated list, not display it.] And of course, we could do similar actions with Favorite Folders.
Windows 11, 22H2 Build 22621.1555 at 100% 2560x1440

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: SC: Favs() - Set or retrieve favorites lists.

Post by TheQwerty »

klownboy wrote:change the list depending on the circumstances and then immediately run Favorite File submenu (CID #564) all on the fly in a script.
It would be possible but there are some hurdles if your hope is to just modify a section of the list as opposed to all of it. Doing such may require putting full trust in managing your favorites to such a script.
klownboy wrote: Would the result of running favs('f'); be equivalent to running #564?
No... favs('f'); would do nothing at all - at least in the user's eyes - since it would just return the list of items and not assign it to any variable or use it in another function/command. Running popupmenu(favs('f',,'|')); would be closer to calling the submenu CIDs but not exact and in fact may not work at all depending on the user's favorites.

Scripts will need to keep in mind that favorites may contain all sorts of things besides just paths - including other scripts and captions.



My thoughts were more towards easing configuration and bring harmony to some otherwise disjointed features (highlighted folders, boxed branches, color filters, custom file icons, and favorite folders).

However, as I was typing the request I also had thoughts about further uses for building favorites from a catalog category (and then updating them), combine that with the other mentioned features and you can drive your color and icon configuration all from the catalog with that script. Take it a step further and you can combine it with paperfolders to "sync" favorites across devices/users.

More than anything it just opens the door to allowing us to (ab)use this feature with scripts and perhaps create new not yet known uses. ;)

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Favs() - Set or retrieve favorites lists.

Post by Filehero »

:whistle:

Any chance this could be added?

FH

admin
Site Admin
Posts: 60357
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: SC: Favs() - Set or retrieve favorites lists.

Post by admin »

Finally I get round to do the irrestible stuff...

Filehero
Posts: 2644
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: SC: Favs() - Set or retrieve favorites lists.

Post by Filehero »

admin wrote:Finally I get round to do the irrestible stuff...
Juhuuuuuuu! :D :D

Thanks man.

LittleBiG
Posts: 1846
Joined: 08 Apr 2011 12:57
Location: Win10x64

Re: SC: Favs() - Set or retrieve favorites lists.

Post by LittleBiG »

Please, make the deletion in favs() a bit smarter. I have a full definition extended with caption and icon. I wish it would be enough to set only the caption to be able to delete an entry, instead of the whole text...

ADDITION: Isn't it possible to delete script entry in favorite by favs()? Because I couldn't.

Post Reply