Page 1 of 1

Ability to add additional context menu commands

Posted: Sat May 06, 2017 2:39 am
by Jebby
Just installed the latest beta and all I have to say is what a masterpiece that just keeps getting better. Your software has created a serious problem for me in that moving to a linux desktop is extremely painful without having this utility. I simply can not use a computer effectively without Everything Search, no BS. I use pretty much every feature Everything has to offer and refuse to stop. :mrgreen:

I have it running perfectly fine under Wine using watched folders to keep local linux filesystem indexed and using a daily updated filelist of a 30TB NAS. I also altered the editable Context Menu items to launch a script which in turn launches the appropriate linux app. All works great. I would like to know if its possible to add some functionality to add custom entries to the Context Menu item list within Everything Search. I would be able to squeeze a crazy amount of usability out of it on Linux and even pull some tricks on Windows with that addition.

Adding that ability I could essentially recreate all the shell extensions I use in windows/linux but launch scripted linux counterparts instead,
add a custom Copy Path to Clipboard that I could convert to native linux path for pasting in native programs, etc. Wine unfortunately is severely lacking in ability to add system wide context shell extensions.

The only other icing on the cake I could think of is ability to have context menu items able to be inside submenus, so I could have ie a GIT context folder, and items within it to keep the popup from getting unwieldy. Add a display rule for on folder, file, both, and extension filter would complete my fantasy feature :D

Something like...

Code: Select all

custom_menu_command1_name=LinuxMenu\GitSubmenu\DoSomethingAwesome
custom_menu_command1_rules="file:*.py|*.cpp"
custom_menu_command1=$exec(cmd,/c,start,/unix,launchwithlinux.bat "%1")
A man can dream right?

Thanks for your time David.

Re: Ability to add additional context menu commands

Posted: Sat May 06, 2017 3:57 am
by void
Thanks for your feedback, glad to hear you find Everything useful!

Customizable context menus is on my TODO list.

The submenus using \ should be easy enough to do, Everything is already using something similar (menu_folders) for filters and bookmarks, added to my TODO list.
The rules idea is good, so the context menu only shows for files matching the specified filter, added to my TODO list.

Re: Ability to add additional context menu commands

Posted: Mon Feb 14, 2022 5:53 am
by Jebby
I just read the 1.5 todo list, I saw
customizable context menu items, need to be able to add new items and set position and $exec command
:o 8-)

Re: Ability to add additional context menu commands

Posted: Tue Dec 20, 2022 6:20 pm
by hairypaulsack
void wrote: Sat May 06, 2017 3:57 am Thanks for your feedback, glad to hear you find Everything useful!

Customizable context menus is on my TODO list.

The submenus using \ should be easy enough to do, Everything is already using something similar (menu_folders) for filters and bookmarks, added to my TODO list.
The rules idea is good, so the context menu only shows for files matching the specified filter, added to my TODO list.
Since everything seems to use the standard shell context menu when right clicking a file, I would assume we could just put our custom commands in using the registry for all or whatever specific extension.

I get a different shell when I try to access a file that is NTFS security blocked (usually accessing some userspace files from an old windows install on an old hard drive (something under that drives/win install that is under %USERPROFILE%

Image

is this a special windows shell context menu for NTFS blocked files or is this specific to everything.

Would it be easy or a good idea to add a takedown command to this pictured shell list if it is indeed an Everything only shell menu?

Folders could have the recursive switch, even if they selected a file you could get parent folder and do no recursive switch.

Code: Select all

takeown /F %selected_dir% /A /R
I just had issues and I remember in the past giving it to admin group didn't work all the time, so must be given to user.


using

Code: Select all

takeown /s %computername% /u %username% /f "%SOME_DIR%" /r /d y
icacls "%SOME_DIR%" /inheritance:r
icacls "%SOME_DIR%" /inheritance:e /grant:r %username%:(OI)(CI)F /t /l /q /c
works great so long as %SOME_DIR% is correct. In this case, I just had to put the folder after like %SOME_DIR%\Target

Re: Ability to add additional context menu commands

Posted: Tue Dec 20, 2022 7:13 pm
by raccoon
I would love the idea of @void adding a bunch of power features right at our fingertips, without having to write a bunch of batch files and manually editing the registry.

One thing I would find useful is the ability to quickly toggle a volume and disk to READONLY, that is, partition and volume header flags as performed by the DISKPART utility, currently. There are probably WinAPIs that could perform these functions but I'm not aware of them.

Clearing file ACLs and deleting ADSs would be handy.

Re: Ability to add additional context menu commands

Posted: Fri Dec 23, 2022 4:10 pm
by NotNull
raccoon wrote: Tue Dec 20, 2022 7:13 pm would love the idea
Me too! Although I would not mind to write my own scripts to 'take care of business'
raccoon wrote: Tue Dec 20, 2022 7:13 pm One thing I would find useful is the ability to quickly toggle a volume and disk to READONLY, that is, partition and volume header flags as performed by the DISKPART utility, currently. There are probably WinAPIs that could perform these functions but I'm not aware of them.
That is something I would use *outside* a file search utility primarily.
I assume you already have somethingf in place to toggle the read-only state? Should not be too hard to write, if you don't.

Re: Ability to add additional context menu commands

Posted: Fri Dec 23, 2022 4:28 pm
by raccoon
I guess I disagree. An advanced file management, search, copy, rename, sharing and presentation utility like Everything should definitely give the user ready control over the ability to preserve and protect their work from accidental and unauthorized modification. The only software available today is the command line utility DISKPART used by approximately 40 people a year, with half of them being unfamiliar with the sequence of commands needed to toggle the READONLY state. Everything has the potential to make this accessible to millions of average joes and teenagers.

Re: Ability to add additional context menu commands

Posted: Fri Dec 23, 2022 5:05 pm
by NotNull
raccoon wrote: Fri Dec 23, 2022 4:28 pm DISKPART used by approximately 40 people a year,
I think I personally already know 40 people who use DISKPART (but all of them professionally; not at home). Doubt if they ever set a volume to read-only, though.

In the meantime I wrote a little something that adds a "Toggle read-only" to the context menu of a drive. Works nicely, in file managers as well as Everything.
Should have been "five minutes of fun", but apparently Windows (11) doesn't like it when unknown applications are run elevated from that context menu. But it's working now.

Lets see how many people here are interested ...

Re: Ability to add additional context menu commands

Posted: Mon Feb 05, 2024 6:21 pm
by NotNull
Just realized that I had written something for that and sent it to @raccoon. Usually I delete stuff like that immediately, but forgot this time.
(might as well post it as It contains some uncommon ways of scripting, so might be of interest just because of that)


Installation

- Run the cmd (as a regular user)
- Follow the UAC prompt
- Done

This will install the "Toggle read-only" context menu for drives
To uninstall the context menu entry: re-run that same cmd


Usage

- Right-click a drive and select "Toggle read-only"
- Follow the UAC prompt
- Done


Toggle_volume Read-only.cmd

Code: Select all

@echo off & setlocal


::  Check if elevated; restart as elevated admin if not. 
    whoami.exe /groups|findstr /i /c:"S-1-16-12288" > nul || goto :NEEDADMIN




	If [%1]==[] goto :CONTEXT


	set "VOLUME=%~d1"
	mode 40,10

::	Set State
	(
		echo sel vol %VOLUME%
		echo detail vol
	) | diskpart | findstr /i /r "^Read-only.*Yes$" >nul

	If ERRORLEVEL 1 (
		set "ACTION=Set"
	) Else (
		set "ACTION=Clear"
	)

	(
		echo sel vol %VOLUME%
		echo attributes volume %ACTION% readonly
	) | diskpart > nul


::	Check State

	(
	echo sel vol %VOLUME%
	echo detail vol
	) | diskpart | findstr /i /r "^Read-only.*Yes$" >nul

	If ERRORLEVEL 1 (
		color 2F
		set STATE=Writable
	) Else (
		color 4F
		set STATE=Read only
	)

	Echo.
	Echo. ==== New state volume %VOLUME%
	Echo.
	Echo.      %STATE%
	Echo.
	
	timeout 2 >nul

goto :EOF





::____________________________________________________________
::
                :NEEDADMIN
::____________________________________________________________
::

    set "TEMPFILE=%LOCALAPPDATA%%\deleteme.AUTOELEVATE"
	 echo.> "%TEMPFILE%"
	
	reg.exe add "HKCU\Software\Classes\.autoelevate\Shell\runas\command" /ve /D "cmd.exe /C \"\"%~f0\"   %%*\" " /F >nul

	start "" "%TEMPFILE%" %*

	reg.exe delete HKCU\Software\Classes\.autoelevate /F >nul
	del /Q %TEMPFILE%

goto :EOF



::-----------------------------------------------
                :CONTEXT
::-----------------------------------------------


	reg.exe query "HKCR\Drive\shell\Toggle-readonly" >nul 2>nul

	If ERRORLEVEL 1 (
		reg.exe ADD "HKCR\Drive\shell\Toggle-readonly\command" /VE /D "\"%~f0\" %%1" >nul
		reg.exe ADD "HKCR\Drive\shell\Toggle-readonly" /V "HasLUAShield" /D "" >nul
		reg.exe ADD "HKCR\Drive\shell\Toggle-readonly" /V "MUIverb" /D "Toggle Read-Only" >nul
		echo Contexxt menu installed
	) Else (
		reg.exe DELETE  "HKCR\Drive\shell\Toggle-readonly" /F >nul
		echo Context menu removed
	)
	pause

goto :EOF



Re: Ability to add additional context menu commands

Posted: Wed Feb 07, 2024 8:34 pm
by Thy Grand Voidinesss
void wrote: Sat May 06, 2017 3:57 am [...]
Customizable context menus is on my TODO list.
[...]
Mp3tag [https://www.mp3tag.de/en/download.html] has a feature

File > Options > Tools

which items are then accessible through right-click sub-menu Tools


It allows for some extra magic to be done but I also often run into its inherit limitations. Maybe it will give you some ideas on how to tackle this endeavor

Re: Ability to add additional context menu commands

Posted: Mon Apr 15, 2024 5:19 am
by void
custom_open_commands can be used to add additional context menu commands.

A UI to customize these commands is still on my TODO list.

Re: Ability to add additional context menu commands

Posted: Mon Apr 15, 2024 4:27 pm
by raccoon
void wrote: Mon Apr 15, 2024 5:19 am custom_open_commands can be used to add additional context menu commands.

A UI to customize these commands is still on my TODO list.
Hey @void, would it be possible to add a custom command that runs As Administrator, without running Everything itself as Administrator? Things like DISKPART require elevation to function.

Re: Ability to add additional context menu commands

Posted: Mon Apr 15, 2024 8:03 pm
by NotNull
Good idea!


Just a sidenote: Diskpart isn't the best example here as this will ask for elevation by itself, due to the requestedExecutionLevel = requireAdministrator in its manifest (that might differ between Windows versions though).

Re: Ability to add additional context menu commands

Posted: Mon Apr 15, 2024 10:38 pm
by void
I'll look into adding a command where you can specify the open verb.

For example:

$exec2("%1","runas")

Thank you for the suggestion.