Categories for Favorite files ?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
CookieMonster

Re: Categories for Favorite files ?

Post by CookieMonster »

@jupe your method requires consistently coping the selected files I want and placing them in a script; so I can have expandable group menus within the favorites files\folders list. Is it possible to drag and drop via scripting, in other words create groups and drag and drop files into these groups which are expandable menus within the favorite files / folders list ?

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Categories for Favorite files ?

Post by jupe »

As already mentioned, with scripting, I was just trying to point out to you an easy alternative for categories that are rather static.

CookieMonster

Re: Categories for Favorite files ?

Post by CookieMonster »

I was hoping for dynamic rather then static.

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Categories for Favorite files ?

Post by jupe »

Ass another easy alternative you can add a line like below to the method that I described in the earlier post (add into the cat1.xys), this item would add the file you have selected to the category it was run from without you having to open the file and do it manually, you could also make it so that if you held Shift and clicked an item that it removed itself from the category, scripting is pretty limitless you should check it out.

Code: Select all

"Add to FAV|:favfiles"  writefile(self("file"),  "<crlf>""<curbase>|<curitem>"" goto self(""icon"");", "a");
Also the Catalog seems like a pretty good alternative to what you want, and can be added to with drag+drop.

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Categories for Favorite files ?

Post by jupe »

I know you really seem to want drag+drop and probably being able to sort the menus manually, but if its of any interest I wrote a script for a favorites button that just contains categories (if you want files/folders in the main menu they would have to be added manually) The add categories button adds a category, then when you click on a category that doesn't previously exist it creates it automatically, then when you select a category you will have an add menu item within the category as well, which when selected will add the currently selected file or folder to that category, then if you don't want that item in that particular category anymore you can hold Shift and select it and it will be removed from that category, the same could be done for the main categories too but I didn't bother doing that, at least not as of yet.
FavCategories.png
FavCategories.png (5.51 KiB) Viewed 2341 times
cons:
  • items will only be displayed in the order you added them in
  • currently this creates the category files in <xyscripts> you will need to modify that if its unacceptable to you, don't name a category the same name as a script you already have in that folder unless you change the default <xyscripts> to <xyscripts\????? first.
  • you could possibly and rarely run into the odd item that doesn't remove via Shift and becomes a zombie, in that case you will have to remove that item manually from the xys file
  • you could accidentally add the same item multiple times to the same category, then when you try and remove it all entries of that item will be removed.
  • the code is condensed [read:messy], it is not in easy to read format, I did this purposely for ease of copying the code blocks
This button seems to be functioning as I intended but I am a novice at scripting so it may have quirks, I am sure you are really looking for something more advanced than this, but if you are interested you can try it by entering the following in the XY address bar:

Code: Select all

snippet;
and then paste the below code block in the dialog that pops up, it will create the new button on the far right of your toolbar, of course for the button to be functional you will need to save the attached script in <xyscripts> first, once you have created some categories the best way to use the button is to click and hold the mouse button down and then release it over the desired category, the button doesn't currently have a right click action, you can add one if you want, suggestions, or tips welcome, insults aren't.

Code: Select all

Snip: CTB 1
  XYplorer 18.70.0103, 25/2/18 6:08:13 PM
Action
  NewUserButton
Name
  Favorites Categories
Icon
  :favfiles
ScriptL
  ::load "FavCategories_v2.xys";
  

ScriptR
  
FireClick
  1
  
Things I might add if any interest is shown:
  • Ability to reorder items, in both categories main and child menus via popup dialog.
  • drop files(s) or folders on button pops a dialog asking which category you want to add them to
  • status messages on add remove items (done not uploaded yet)
  • ability to remove categories the same way as files/folder(s)


In v2 I made the "Add Categories" menu item create the category and add it to the menu at the same time now, slightly cleaned code
FavCategories_v2.xys
(903 Bytes) Downloaded 154 times
FavCategories.xys
(784 Bytes) Downloaded 135 times
[/size]

CookieMonster

Re: Categories for Favorite files ?

Post by CookieMonster »

I look forward to trying the script although. Is it possible, rather then within a custom user button pasting the code for the script; loading the script as a file from a folder ?

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Categories for Favorite files ?

Post by jupe »

Yes it is possible, I was just trying to make it easier for you, if you restarted XY so that all your current settings were saved and then followed the steps provided to add it to the toolbar just to try it, then you could select "File | Exit without Saving", and it would be as though you had never added it to the toolbar (or you might have instant save settings activated! which would save your settings, or use the new readonly mode of XY instead).

But the script can just be downloaded and run however you prefer, it is just a very early iteration of it, so if you do think you would use it don't go crazy creating all your categories because something in the script might change, soon I will probably add more features, keep in mind that by default it will create files in the <xyscripts> directory named as your category names, you'd have to manually delete those currently.

CookieMonster

Re: Categories for Favorite files ?

Post by CookieMonster »

What I meant was, when creating a custom button in the toolbar there are two options; OnLeftClick & OnRight Click.

Within either option you can paste a script; rather then pasting a script file how can one put a path to a script (xys) file this way the custom button is dynamic and instead of pasting code you just direct it to a new file name where the scripts are located ?

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Categories for Favorite files ?

Post by jupe »

But for this particular script, you can see in the snippet code box above, I am already doing that, so you must be talking about this for some other circumstance.

you can enter this (same as above):

::load "c:\path\to\the\file\filename.xys";

CookieMonster

Re: Categories for Favorite files ?

Post by CookieMonster »

On left click I have the following code, although I'm getting an error ?

Code: Select all

::load "C:\Custom Program Settings\XYplorer\ScriptsFavCategories_v2.xys";
Unless I'm mistaken, this script works in any window pane by simply right clicking and adding a file or folder to a category ? If so that is very efficient but; it doesn't take into account existing favorite files or folders already in existence by means of XY regular Favorites > Files & Favorites > Folders ?

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Categories for Favorite files ?

Post by jupe »

::load "C:\Custom Program Settings\XYplorer\ScriptsFavCategories_v2.xys";

you are missing a \ between Scripts and FavCategories

No this is meant to replace Favorites Files or Favorites Folder button, you could still use those separately too though, Currently to add an item you would have clicked the toolbar button (if you had added it) then added a category to start then once you have a category you would click the button again and then select the category, then it pops up the category menu which has an add menu item, like in the screenshot, pressing that would add your currently selected file or folder to that category.

As explained in the above post if using the snippet you would press the button and hold the mouse button down then release it over the category you want to go into.

You could set it up to launch on a keyboard shortcut too if you wanted.

CookieMonster

Re: Categories for Favorite files ?

Post by CookieMonster »

I've got it working, although it doesn't work on folders ?

There is no way of seeing the favorite files without diving into the category ?

And I assume I'd have to manually copy XY favorite files or folders to this version of favorite files or folders to see my list ?

jupe
Posts: 3292
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Categories for Favorite files ?

Post by jupe »

CookieMonster wrote:I've got it working, although it doesn't work on folders ?
It works on my end, what happens?, I may have introduced a bug when I hurriedly uploaded an update.
CookieMonster wrote:There is no way of seeing the favorite files without diving into the category ?
No the menu's aren't nested, currently that would be a lot more work, I just whipped this up in an hour or so as a trial, as I said it is designed via the snippet to be one click and hold then release the mouse over the category you want, you should know what category you need, considering this is designed around "Favorites" not random obscure files.
CookieMonster wrote:And I assume I'd have to manually copy XY favorite files or folders to this version of favorite files or folders to see my list ?
I could write a script to import them, but it sounds like this script isn't suitable for you, I didn't make it import favorites automatically because 1) not everyone might want that, 2) this was just a first draft. I shouldn't have uploaded it yet really it is rough around the edges to say the least, I'd call it a bad proof of concept.

I think you need to look elsewhere, or in the help file under scripting to meet your criteria.

highend
Posts: 14571
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Categories for Favorite files ?

Post by highend »

to look elsewhere, or in the help file under scripting
Good joke :tup:
One of my scripts helped you out? Please donate via Paypal

CookieMonster

Re: Categories for Favorite files ?

Post by CookieMonster »

jupe wrote:
CookieMonster wrote:I've got it working, although it doesn't work on folders ?
It works on my end, what happens?, I may have introduced a bug when I hurriedly uploaded an update.
CookieMonster wrote:There is no way of seeing the favorite files without diving into the category ?
No the menu's aren't nested, currently that would be a lot more work, I just whipped this up in an hour or so as a trial, as I said it is designed via the snippet to be one click and hold then release the mouse over the category you want, you should know what category you need, considering this is designed around "Favorites" not random obscure files.
CookieMonster wrote:And I assume I'd have to manually copy XY favorite files or folders to this version of favorite files or folders to see my list ?
I could write a script to import them, but it sounds like this script isn't suitable for you, I didn't make it import favorites automatically because 1) not everyone might want that, 2) this was just a first draft. I shouldn't have uploaded it yet really it is rough around the edges to say the least, I'd call it a bad proof of concept.

I think you need to look elsewhere, or in the help file under scripting to meet your criteria.
I can add folder to a category by means of a folder pane. Although I can't add a folder to a category by means of the folder tree (Shift+F8).

It's nice I can mix and match favorite files and folders, as mentioned to be able to have nested menus for categories would be nice; and I understand you created this in very little time although a good start. And when I mentioned that I have to manually copy XY favorite files or folders to this tools categories; I was simply asking as a question, nothing more. ;)

Post Reply