How to set a user button to show folder content in pop-up menu?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
cadu
Posts: 247
Joined: 18 Mar 2012 21:50

How to set a user button to show folder content in pop-up menu?

Post by cadu » 13 Jun 2019 14:15

Hi,
I'd appreciate help.
I would like to set a user button to show folder content in a pop-up menu. Is it possible? How to?
Below there is a snapshot simulating what I'm trying to achieve for the path "Z:/".
For instance, if I add the command [goto "Z:\"] in a user button, XYplorer will navigate to that path.
I don't want to navigate, but expect a pop-up menu with the folders/files under Z:/ being listed.
If I click on one of the folders/files through the user button pop-up menu, just then XYplorer would navigate to a folder or run a file.
Thank you very much!

Image

highend
Posts: 8622
Joined: 06 Feb 2011 00:33

Re: How to set a user button to show folder content in pop-up menu?

Post by highend » 13 Jun 2019 14:34

Script it?

Get files and folders for the current path (separately)
Bring them in the correct form for popupmenu (caption|data|icon), otherwise you wouldn't see any icons...
Display them and for the selected one decide depdending on if it is a file or a folder if you use a goto or an open command...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

cadu
Posts: 247
Joined: 18 Mar 2012 21:50

Re: How to set a user button to show folder content in pop-up menu?

Post by cadu » 13 Jun 2019 15:05

Thanks for the reply @highend!
Get files and folders for the current path (separately)
You mean I should enter in the user button each folder content (subfolders/files) line by line, as shown in the snapshot below?
Image
Script it?
By using a script would there be a single command to list everything under Z: in a menu?
I was trying to make a dynamic menu, sensitive to changes under the folder, without the need to enter line by line each time the folder content changes.

highend
Posts: 8622
Joined: 06 Feb 2011 00:33

Re: How to set a user button to show folder content in pop-up menu?

Post by highend » 13 Jun 2019 15:07

You mean I should enter in the user button each folder content (subfolders/files) line by line, as shown in the snapshot below?
Ofc not. There is listfolder() / quicksearch()...
By using a script would there be a single command to list everything under Z: in a menu?
No, it requires multiple commands to get files / folders, reformat them...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

RalphM
Posts: 1284
Joined: 27 Jan 2005 23:38
Location: Cairns, Australia

Re: How to set a user button to show folder content in pop-up menu?

Post by RalphM » 13 Jun 2019 16:36

Has the OP discovered "Hover Box" yet?
It seems to me this is about replicating the same behavior with a button.
Ralph :-)
(OS: W10 1809 Home x64 - XY: Current beta)

cadu
Posts: 247
Joined: 18 Mar 2012 21:50

Re: How to set a user button to show folder content in pop-up menu?

Post by cadu » 13 Jun 2019 16:57

highend wrote:
13 Jun 2019 15:07
Ofc not. There is listfolder() / quicksearch()...
RalphM wrote:
13 Jun 2019 16:36
Has the OP discovered "Hover Box" yet?
Thank you all for sharing these functionalities. I was not aware of them. Starting using just now!

Regarding user button usage for access folder content, I have a further question you may help me with:
I added into "left-click script" (user button) a simple list of folders.
As shown in the snapshot below, why folders starting with _ (underline) aren't listed in pop-up user button menu?
Any workaround to force those _ folders to appear in the menu?

Image

jupe
Posts: 1266
Joined: 20 Oct 2017 21:14
Location: 1909 x64

Re: How to set a user button to show folder content in pop-up menu?

Post by jupe » 14 Jun 2019 09:40

Since you seem to keep being informed of functionalities you "aren't aware of" perhaps you should read the help file to enlighten yourself, because that is where the answers come from that are supplied to you regularly, for this particular query I suggest this topic:

Scripting > Script Files for the Advanced

but you don't have to stop there.

PS: Quotes can fix a lot of problems.

cadu
Posts: 247
Joined: 18 Mar 2012 21:50

Re: How to set a user button to show folder content in pop-up menu?

Post by cadu » 15 Jun 2019 23:26

jupe wrote:
14 Jun 2019 09:40
(...) for this particular query I suggest this topic:
Scripting > Script Files for the Advanced
Thanks for the directions!
After exploring the 'Script Files for the Advanced', I could elaborate the following syntax to list in the user menu button the folders having _ (underline) with their respective embedded icons:

Code: Select all

"Media|C:\!APPS\_Media|*" goto "C:\!APPS\_Media";
XYplorer syntax.png
XYplorer syntax.png (16.12 KiB) Viewed 491 times

However, I'm still having problem with _ (underline), now related to the label.
If I prefix underline to _Media, the command doesn't appear in the menu anymore:

Code: Select all

"_Media|C:\!APPS\_Media|*" goto "C:\!APPS\_Media";
HELP a) Does anyone know how to force _ in the label name, but keeping the command working (folder appearing)?

HELP b) Is the script above really necessary to show folders having _underline? Would there be a simpler solution?
I mean, if the folder didn't have _ underline character, it would be necessary simply using the raw folder path (e.g. C:\!APPS\Media) to have the folder appearing with icon in the user button menu.
I did try to use quotes direct "C:\!APPS\_Media", but it didn't work.

I also recorded my screen showing the issues I'm facing in details: http://bit.ly/2KSVz9g

Thank you!

jupe
Posts: 1266
Joined: 20 Oct 2017 21:14
Location: 1909 x64

Re: How to set a user button to show folder content in pop-up menu?

Post by jupe » 16 Jun 2019 03:38

  1. "&_Media|C:\!APPS\_Media" goto "C:\!APPS\_Media";
  2. There are different solutions, one of which is using a popupmenu instead (which was already suggested to you in the first reply you received to this same topic also how to use popupmenus has previously been explained to you here: viewtopic.php?t=16936#p145462 and other topics, as well as in the help file) but easier is debatable, anyway you are planning to create this menu dynamically via script, so it shouldn't really matter.

cadu
Posts: 247
Joined: 18 Mar 2012 21:50

Re: How to set a user button to show folder content in pop-up menu?

Post by cadu » 19 Jun 2019 01:22

Many thanks for your reply!
Regarding popup menus (from user button), I'm facing an issue I'd appreciate further help

When I insert in the user button a single line script to copy an item and paste in the current path, it works:

Code: Select all

copyitem "Z:\Templates\File.pdf", "*.?";
However, when I insert that script into a popup menu, it isn't working anymore:

Code: Select all

$menus = <<<>>>
copyitem "Z:\Templates\File1.pdf", "*.?";
copyitem "Z:\Templates\File2.pdf", "*.?";
>>>;
    popupmenu($menus, , , , , , <crlf>);
What could be going wrong with the script running through a popup menu?

highend
Posts: 8622
Joined: 06 Feb 2011 00:33

Re: How to set a user button to show folder content in pop-up menu?

Post by highend » 19 Jun 2019 01:36

That command returns a selection (a string!) from what the menu displayed...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

Post Reply