Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separate location for log files ? (and exclusions?) #108

Open
mdnava opened this issue Apr 20, 2022 · 6 comments
Open

Separate location for log files ? (and exclusions?) #108

mdnava opened this issue Apr 20, 2022 · 6 comments

Comments

@mdnava
Copy link

mdnava commented Apr 20, 2022

I just found out about this extension by mere chance.. I've been using KuShellExtension for a few years now, which has been very useful and works very well, but hasn't been updated in over 10 years. This extension looks like the perfect replacement, but it would take me while to convert from KuShellExt to ShellAnything (my KSE config file is about 900 lines).

I'd like to ask a couple questions if that's ok..

  1. Is there a way to change the location for the logs folder, or the location for the config files without the logs?.. I ask this because I share the Windows context menus among several computers by putting the KuShellExt config file in a cloud folder. I could implement a junction with the ShellAnything config folder, but it contains log files with file locking that will interfere with proper cloud synchronization and will prompt sync errors.

  2. Is there a way to add a context menu to all folders but exclude the Desktop?

@end2endzone
Copy link
Owner

Hi. Thank you for showing interest in ShellAnything.

  1. This is a feature I never though about and it is not how I use the extension myself. I mostly copy & paste my configurations across all my computers "once" and don't change them much. When I do, I resynchronize them from a "master" computer (copy them from \\mastercomputer\c$\Users\%USERNAME%\ShellAnything to each local computers).
    1. Right now, there is no way to change the Configuration or Log directories. If you can find a good way to implement and document this, I would be willing to integrate it to the application. Maybe by adding an "override" in the registry would be a good start. I am open to suggestions. Unfortunately, the "plugin system" (issue 50) right now is using all my free time and I would not be able to implement this myself in a near future. If you want to submit a pull request, I will
    2. I have also never tested ShellAnything with network paths (paths that starts with \\computername\sharename). It might work or not. On a worst case, you might have to "map a network drive" but this is probably too much hassle for your simple use case. If mapping a network drive is not an option, you could also override the Configuration and Log directories to your DropBox-like local directory. This would be transparent for ShellAnything.
    3. Have you tried to use a Junction to "share" the same Configuration and Log directories ? It might work. You should not have conflicts about file names because the log files are prefixed with the File Explorer's process id. For example, shellext-d.dll.WARNING.20220417-170528.8616.log where 8616 is my process id. Running multiple ShellAnything instance that share the same log directory might work. However, the files would be identified as "in use" (log files are closed when the extension is unloaded or when all instances of File Explorer are closed). I assume that a cloud synchronization software should identify files that are "in use" (and maybe warn the user about it) but not fail the synchronization process. Downloading log files (when running the synchronization) from other sources should not conflict with existing files. Keep my updated if you try this.
  2. Yes. I think you can validate your use case with something like this:
    <visibility class="directory" pattern="${env.USERPROFILE}\Desktop" inserve="pattern" />.
    I have not tested this myself but you get the idea. The attribute class="directory" forces the menu to be visible only when a directory is selected. You could also force how many directory can be selected with maxfiles="0" maxfolders="99999". The pattern attribute matches only your Desktop directory (it will make the menu visible only when your right click on your Desktop directory). However, ShellAnything supports the inverse attribute which inverses the logic of an attribute. Inversing your pattern will match all directories except when the selected path is exactly your Desktop directory. Basically, it converts the pattern to "everything but your Desktop directory". You can look at other attributes for validation in the User Manual.
  3. On a side note, you are not the first one that contacts me about migrating from KuShellExtension. I would like to add a section in the User Manual for helping with the migration. Maybe something like "how to map feature X of KuShellExtension to ShellAnything" or provide a "generic" KuShellExtension xml file and its equivalent in ShellAnything format. If you are willing to provide feedback or instructions (preferably in markdown format), I would gladly add them to the User Manual.

Waiting for your feedback.

@end2endzone
Copy link
Owner

Also, if you like ShellAnything, please consider leaving a star to the project. I think this is the best way to increase the visibility of the project.

@mdnava
Copy link
Author

mdnava commented Apr 20, 2022

@end2endzone Thank you for answering..

  1. Right now, there is no way to change the Configuration or Log directories. If you can find a good way to implement and document this, I would be willing to integrate it to the application. Maybe by adding an "override" in the registry would be a good start. I am open to suggestions. Unfortunately, the "plugin system" (issue 50) right now is using all my free time and I would not be able to implement this myself in a near future. If you want to submit a pull request, I will

I think the easier way to go would be to move the "Logs/" directory to %LOCALAPPDATA%\ShellAnything\Logs and leave the config files on %USERPROFILE%\ShellAnything (or put them in the roaming directory: "%APPDATA%\ShellAnything").

  1. Have you tried to use a Junction to "share" the same Configuration and Log directories ? It might work. You should not have conflicts about file names because the log files are prefixed with the File Explorer's process id. For example, shellext-d.dll.WARNING.20220417-170528.8616.log where 8616 is my process id. Running multiple ShellAnything instance that share the same log directory might work. However, the files would be identified as "in use" (log files are closed when the extension is unloaded or when all instances of File Explorer are closed). I assume that a cloud synchronization software should identify files that are "in use" (and maybe warn the user about it) but not fail the synchronization process. Downloading log files (when running the synchronization) from other sources should not conflict with existing files. Keep my updated if you try this.

Yes, I did try a junction from "%OneDrive%\CloudAppData\ShellAnything" and the Logs folder prompted sync errors in OneDrive. It happened exactly what you described: it identified files as "in use" and made some warnings. This is usually harmless, but I've had some experience with this. First, the warnings are there, always and forever. Then it could happen that, if there are enough sync issues in queue the sync process can actually fail altogether, it freezes completely. They pile up.

  1. Yes. I think you can validate your use case with something like this:
    <visibility class="directory" pattern="${env.USERPROFILE}\Desktop" inserve="pattern" />.
    I have not tested this myself but you get the idea. The attribute class="directory" forces the menu to be visible only when a directory is selected. You could also force how many directory can be selected with maxfiles="0" maxfolders="99999". The pattern attribute matches only your Desktop directory (it will make the menu visible only when your right click on your Desktop directory). However, ShellAnything supports the inverse attribute which inverses the logic of an attribute. Inversing your pattern will match all directories except when the selected path is exactly your Desktop directory. Basically, it converts the pattern to "everything but your Desktop directory". You can look at other attributes for validation in the User Manual.

Thank you. I will try this and get back to you with a comment (next week possibly, sth personal just came up that I have to deal with). It will certainly be very useful. Is one thing I could not make work with KuShellExt. If there's an inverse or negated parameter I could not find it documented. Whatever I put in "folders" shows up also on the Desktop.

2022-04-20 17 50 00 crop

In this image you can see some options that I intend to use only on folders (like "IDE from here", "Shell from here", "Manage Folder", "Manage Images"), but not from the Desktop where they occupy screen real state and add up to the apparent limit for contextual objects. I can use these programs on any computer because they're all in a OneDrive folder, so I don't have to update every one of them, every time a new version comes up. It helps with consistency. Then the Start menu is left for programs that require installation like Office or Adobe Software.

  1. On a side note, you are not the first one that contacts me about migrating from KuShellExtension. I would like to add a section in the User Manual for helping with the migration. Maybe something like "how to map feature X of KuShellExtension to ShellAnything" or provide a "generic" KuShellExtension xml file and its equivalent in ShellAnything format. If you are willing to provide feedback or instructions (preferably in markdown format), I would gladly add them to the User Manual.

I might be able to write up something once I'm more familiar with ShellAnything.
This is a shortened example for KuShellExt (config.xml):

<config version="1">
	<var name="archive">.001 .7z .ace .arj .bzip2 .cab .gz .gzip .lha .lzh .mzp .rar .rmskin .tar .wzp .xz .z .zip</var>
	<var name="audio">.aac .ac3 .aiff .ape .flac .m4a .m4b .m4r .mp+ .mp2 .mp3 .mpc .wma .ra .mka .ape .ogg .flac .tta .tak .wav .wv</var>
	<var name="code">.ahk .asm .asp .aspx .au3 .awk .bat .bsh .c .cjs .cmd .cpp .cs .csh .dart .erl .ex .exs .fish .go .groovy .gvy .gy .java .jl .js .jsx .ksh .kts .lua .mjs .p6 .p .pas .php .phtml .pl6 .pl .pp .ps1 .psd1 .psm1 .py .pyw .rb .rbw .rs .scala .sh .tcl .vb .vbs .wlua .wsf .xaml .yaml .yml .zsh</var>
	<var name="docs">.chm .doc .docm .docx .dot .dotm .dotx .epub .gnm .gnumeric .mobi .odt .pdf .potx .potm .ppam .ppsm .ppsx .pps .ppt .pptm .pptx .rtf .sldm .sldx .thmx .vsd .wpd .wps .wri .xlam .xls .xlsb .xlsm .xlsx .xltm .xltx</var>
	<var name="image">.avif .bmp .heic .heif .jpg .jpe .jpeg .jfif .jif .png .tga .tif .tiff .webp</var>
	<var name="imageapng">.png .apng</var>
	<var name="imageraw">.arw .dng .cr2 crw .nef .nrw .raw .sr2 .srf</var>
	<var name="text">.cfg .conf .csv .inf .ini .json .log .lrc .mn .mnx .txt .text .xml</var>
	<var name="video">.avi .divx .f4v .flv .m2t .m2ts .m4v .mkv .mov .mp4 .mp4v .mpg .mpeg .mts .wmv .rm .rmvb .vob .webm .wmp .wmv</var>

	<!-- Folder Context (will appear also on the Desktop) -->
	<!-- The use for workdir="." sets the working directory to the program location, 
	otherwise it'll be where the context menu is called -->
	<menu name="Manage folder" class="folder" icon="D:\USER\OneDrive\Depot\Icons\{Context}\folder_managemore.ico">
		<menuitem name="XYplorer [LR]" workdir="." icon="D:\USER\OneDrive\Programs\XYplorer\XYplorer\XYplorer.exe,0">D:\USER\OneDrive\Programs\XYplorer\XYplorerRun.vbs %*</menuitem>
		<menuitem name="----" />
		<menuitem name="grepWin" workdir="." icon="D:\USER\OneDrive\Programs\_Utilities\Stefans-grepWin\grepWin.exe,0">wscript.exe D:\USER\OneDrive\Programs\_Utilities\Stefans-grepWin\grepWinRun.vbs %*</menuitem>
		<menuitem name="TextCrawler" workdir="." icon="D:\USER\OneDrive\Programs\_Utilities\TextCrawler\TextCrawler.exe,0">wscript.exe D:\USER\OneDrive\Programs\_Utilities\TextCrawler\MN_Run.vbs %*</menuitem>
		<menuitem name="Search on the Web" icon="D:\USER\OneDrive\Command\EnvScripts\Bin\WebSearch.exe,0">D:\USER\OneDrive\Command\EnvScripts\Bin\WebSearch.exe %*</menuitem>
		<menuitem name="WinMerge Compare" workdir="." icon="D:\USER\OneDrive\Programs\WinMerge-Compare\WinMergeU.exe,0">D:\USER\OneDrive\Programs\WinMerge-Compare\WinMergeU.exe %*</menuitem>
		</menu>
	</menu>

	<!-- Images Context -->
	<!-- The use for console="false" allows to execute a console program but hide the console -->
	<menu name="Convert for the Web" class="${var:image}" icon="D:\USER\OneDrive\Depot\Icons\{Folder}\images.ico">
		<menuitem name="Cover 1:1" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\generic.ico">D:\USER\OneDrive\Command\EnvScripts\image-magick.cmd -aspectratio 1:1 -center %@</menuitem>
		<menuitem name="Photo 3:2" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\generic.ico">D:\USER\OneDrive\Command\EnvScripts\image-magick.cmd -aspectratio 3:2 -center %@</menuitem>
		<menuitem name="----" />
		<menuitem name="Wide 16:9 (top)" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\generic.ico">D:\USER\OneDrive\Command\EnvScripts\image-magick.cmd -aspectratio 16:9 -top %@</menuitem>
		<menuitem name="Wide 16:9 (middle)" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\generic.ico">D:\USER\OneDrive\Command\EnvScripts\image-magick.cmd -aspectratio 16:9 -center %@</menuitem>
		<menuitem name="Wide 16:9 (bottom)" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\generic.ico">D:\USER\OneDrive\Command\EnvScripts\image-magick.cmd -aspectratio 16:9 -bottom %@</menuitem>
		<menuitem name="----" />
		<menuitem name="JPEG 3000L" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\jpg.ico">D:\USER\OneDrive\Command\EnvScripts\image-transform.cmd %@ jpeg 85 3000 defa defa nometa</menuitem>
		<menuitem name="JPEG 2000L" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\jpg.ico">D:\USER\OneDrive\Command\EnvScripts\image-transform.cmd %@ jpeg 85 2000 defa defa nometa</menuitem>
		<menuitem name="JPEG 1200L" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\jpg.ico">D:\USER\OneDrive\Command\EnvScripts\image-transform.cmd %@ jpeg 85 1200 defa defa nometa</menuitem>
		<menuitem name="JPEG 1000L" console="false" icon="D:\USER\OneDrive\Depot\Icons\{Filetype}\jpg.ico">D:\USER\OneDrive\Command\EnvScripts\image-transform.cmd %@ jpeg 85 1000 defa defa nometa</menuitem>
	</menu>

	<!-- Desktop Context -->
	<!-- The var ${Desktop} is preset in KuShellExt and the use for "at:" sets the location where the menu should appear -->
	<menu name="Applications" class="at:${Desktop}" icon="C:\Windows\System32\dsuiext.dll,9">
		<menuitem name="CherryTree" icon="D:\USER\OneDrive\Programs\CherryTree\cherrytree.ico">D:\USER\OneDrive\Programs\CherryTree\mingw64\bin\cherrytree.exe</menuitem>		
		<menuitem name="Typora" icon="D:\USER\OneDrive\Programs\Typora-MD\Typora\Typora.exe,0">D:\USER\OneDrive\Programs\Typora-MD\Typora\Typora.exe</menuitem>
		<menuitem name="----" />
		<menuitem name="Draw.io" icon="D:\USER\OneDrive\Programs\_Diagram\Draw.io\draw.io.exe,0">D:\USER\OneDrive\Programs\_Diagram\Draw.io\draw.io.exe</menuitem>
		<menu name="LibreOffice //" class="at:${Desktop}" icon="D:\USER\OneDrive\Programs\LibreOffice\program\soffice.exe,0">
			<menuitem name="LibreOffice Base" icon="D:\USER\OneDrive\Programs\LibreOffice\program\sbase.exe,0">D:\USER\OneDrive\Programs\LibreOffice\program\sbase.exe</menuitem>
			<menuitem name="LibreOffice Calc" icon="D:\USER\OneDrive\Programs\LibreOffice\program\scalc.exe,0">D:\USER\OneDrive\Programs\LibreOffice\program\scalc.exe</menuitem>
			<menuitem name="LibreOffice Draw" icon="D:\USER\OneDrive\Programs\LibreOffice\program\sdraw.exe,0">D:\USER\OneDrive\Programs\LibreOffice\program\sdraw.exe</menuitem>
			<menuitem name="LibreOffice Impress" icon="D:\USER\OneDrive\Programs\LibreOffice\program\simpress.exe,0">D:\USER\OneDrive\Programs\LibreOffice\program\simpress.exe</menuitem>
			<menuitem name="LibreOffice Web" icon="D:\USER\OneDrive\Programs\LibreOffice\program\swriter.exe,0">D:\USER\OneDrive\Programs\LibreOffice\program\sweb.exe</menuitem>
			<menuitem name="LibreOffice Writer" icon="D:\USER\OneDrive\Programs\LibreOffice\program\swriter.exe,0">D:\USER\OneDrive\Programs\LibreOffice\program\swriter.exe</menuitem>
		</menu>
	</menu>
</config>

As for how KuShellExt handles parameters: with %* all parameters are sent at once to the program, when filenames contain spaces double quotes are added; and with %@ the program is executed once for each parameter. There are also other options like: %1 %2 %3 ... %9; built-in variables like: ${env:Desktop} ${env:ProgramFiles} ${env:Downloads}; and environment vars can be used like; ${env:JAVA_HOME} ... Classes are somewhat similar to what I read with ShellAnything: ".ext" ".*" ".folder" "drive" "drive:removable" "drive:fixed" "drive:network" "drive:optical" "drive:ramdisk" "at:PATH" "in:DIR"

I hope this helps..

@mdnava
Copy link
Author

mdnava commented Apr 22, 2022

Hello again..

After some trial and error I made it work so the menu opens in all folders, excluding the Desktop:

<?xml version="1.0" encoding="utf-8"?>
<root>
  <shell>
    <menu name="ShellAny Test">
      <icon path="C:\Windows\System32\dsuiext.dll" index="0" />
      <visibility class="directory" pattern="${env.Desktop}" inverse="pattern" />
      <menu name="Code">
        <icon path="D:\USER\OneDrive\Programs\VSCode\Code.exe" index="0" />
        <actions>
          <!-- <property name="selection.multi.separator" value="&quot; &quot;" /> -->
          <exec path="D:\USER\OneDrive\Programs\VSCode\Code.exe" arguments="&quot;${selection.path}&quot;" />
          <!-- <property name="selection.multi.separator" value="${line.separator}" /> -->
        </actions>
      </menu>
      <menu name="Sublime">
        <icon path="D:\USER\OneDrive\Programs\SublimeText\sublime_text.exe" index="0" />
        <actions>
          <!-- <property name="selection.multi.separator" value="&quot; &quot;" /> -->
          <exec path="D:\USER\OneDrive\Programs\SublimeText\sublime_text.exe" arguments="&quot;${selection.path}&quot;" />
          <!-- <property name="selection.multi.separator" value="${line.separator}" /> -->
        </actions>
      </menu>
    </menu>
  </shell>
</root>

Which is awesome :) .. But some questions arise..

[== 1 ==]
Is there a way to change the position of the context menus?..
I tried this.. I renamed:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shellex\ContextMenuHandlers\ShellExtension.ShellAnything

To:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shellex\ContextMenuHandlers\aShellExtension.ShellAnything

And it worked, the context menu in folders shows up above the AntiVirus scan, which is what I want.. but will this keep working? would the extension restore or create the original registry entry at some point?.. If so, can the change be made permanent?

[== 2 ==]
How can I execute a console program but hide the console?..
Could not find it in the manual, and is very important.

[== 3 ==]
According to the manual, to handle multiple arguments, I should use this:

<actions>
<property name="selection.multi.separator" value="&quot; &quot;" />
<exec path="D:\USER\OneDrive\Programs\VSCode\Code.exe" arguments="&quot;${selection.path}&quot;" />
<property name="selection.multi.separator" value="${line.separator}" />
</actions>

I tried it but it didn't work, I got this in the log:

E0421 23:29:43.632731 14660 shellext.cpp:708] CContextMenu::InvokeCommand(), action #2 has failed: El nombre de archivo, el nombre de directorio o la sintaxis de la etiqueta del volumen no son correctos.

But it works with a single selection (any of the same folders I tried with the multiple selection)..

[== 4 ==]
Also, If I may comment about this last issue.. this is very verbose. I think config files are gonna be triple the size they should be, which makes them harder to maintain. In my particular case almost every command I use handles multiple arguments, being files and/or folders and/or options. I believe ${selection.path} should handle the use of quotes when there are any spaces in arguments, or at the very least a new var (like ${selection.paths}) should. Just a thought.

For what I've been able to see, ShellAnything has an edge in memory usage in comparison with KuShellExtension (which works great when the config file is left alone, but seems to have some sort of incremental memory leakage after each configuration update – a restart of explorer.exe or the OS is often required after about 20 or so updates). However, I think the verbosity of ShellAnything makes it difficult to implement. A 900 line config file could easily become 10.000 lines or more.

BTW!.. log files.. VERY useful..

Hoping to read your feedback..

Have a nice weekend !!

@end2endzone
Copy link
Owner

Thank you for the feedback. Much appreciated.

[== 1 ==]
I didn't know you could do this. Does this means Windows shows extensions according to the alphabetical order of their entries in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shellex\ContextMenuHandlers? To answer your question, no, ShellAnything does not read or write to this location in the registry unless you register or unregister the shell extension with unregister.bat, or register.bat.

However, if you try to unregister, the shell extension will expect the registry key to be named ShellExtension.ShellAnything and will probably fail to delete the key ShellExtension.ShellAnything and also fail to unregister itself from the system. This will be a problem if you want to upgrade to a newer version of the extension.

If so, can the change be made permanent?

Just to be clear, are you asking to rename the extension to aShellExtension.ShellAnything within the source code ? That is a possibility. However, it is only temporary. It will "work" until you register a shell extension named 1foobar which will create menu entries before ShellAnything. I would like to keep this issue specific to "moving the location of Configuration and Logs directories". Other considerations should be tracked in a different issue. No offence but its a lot easier for me to plan changes in the software.

[== 2 ==]
Unfortunately, that is a feature that is not supported by ShellAnything at the moment. I do not see any problem implementing such a feature. For example, the <exec> action could have a new attribute called console that accept values such as true or false. It would be very similar to the KuShellExt example above. I suggest that you open a new issue for tracking this feature. I would also appreciate a little help with this and would gladly accept a pull request that implements such a feature.

Until then, you could implement our own executable that spawn your final process and hide the console.

[== 3 ==]
I don't understand your issue. It should work as expected. For example, to see how the whole thing gets expanded, you can display the list of arguments with &quot;${selection.path}&quot; with the following:

<message title="&quot;${selection.path}&quot;" />

I also created the following Configuration example which is using Visual Studio Codium instead of Visual Studio Code (both software have the same code base) :

<?xml version="1.0" encoding="utf-8"?>
<root>
  <shell>
  <menu name="Open with VSCodium">
    <icon path="C:\Program Files\VSCodium\VSCodium.exe" index="0" />
    <visibility exists="C:\Program Files\VSCodium\VSCodium.exe" />
    <actions>
      <property name="selection.multi.separator" value="&quot; &quot;" />
      <message title="&quot;${selection.path}&quot;" />
      <exec path="C:\Program Files\VSCodium\VSCodium.exe" arguments="&quot;${selection.path}&quot;" />
      <property name="selection.multi.separator" value="${line.separator}" />
    </actions>
  </menu>    
  </shell>
</root>

And clicking on 4 files actually show the expected message:
image
note the " character before and after each files. A space is inserted between files but Windows automatically show the full string as if there were ${line.separator} between each files. That is not the case.
After pressing OK, all the files are opened in Visual Studio Codium:
image

Maybe you are having an issue since your Windows copy is Spanish. Or because the path to "D:\USER\OneDrive\Programs\VSCode\Code.exe" is incorrect. Its hard to say from my point of view. The message you see in the logs is one reported by your Operating System, not from ShellAnything. I suggest you try again. Also debugging visually with the <message> action could also help. You can press CTRL+C on the popup displayed by a MessageBox (<message>) which will copy the content of the MessageBox as text. This is usefull to validate if the paths displayed in the message are correct. You can also try to "paste" the result (including the double quotes) in a command prompt and see if VSCode is launched and actually opens all the files in the arguments.

[== 4 ==]

If I may comment about this last issue.. this is very verbose. I think config files are gonna be triple the size they should be, which makes them harder to maintain.

Looking at how many menus you have in your screenshot above, I have no doubt about this! I have created #109 as a suggestion to reduce the amount of logging. I suggest you add a comment for feedback or another idea to solve the problem in order to keep track of the progress about this problem and receive a notification when it will be resolved.

I believe ${selection.path} should handle the use of quotes when there are any spaces in arguments, or at the very least a new var (like ${selection.paths}) should. Just a thought.

Respectfully, I disagree since I do not think this is necessary. Like I said in 3, please try again. Other users has confirmed this issue working on their side. See #87 and #52 for details. If the issue persist, create another issue and I will request help from other users that have a non-English Windows. I have also created #110 which once available, could help other in the same situation. Again, I suggest you add a "dummy comment" just to get a notification when it will be resolved.

Thank you again for all your help and suggestion. It is much appreciated. I did not know about KuShellExt before I started this project. I am glad to see that most features can be mapped to ShellAnything because people seems to be migrating from KuShellExtension to ShellAnything. This means the application is "mature" (kind of) and can be used by a lot a people - from multiple locations - speaking different languages.

@mdnava
Copy link
Author

mdnava commented Apr 23, 2022

[== 1 ==] I didn't know you could do this. Does this means Windows shows extensions according to the alphabetical order of their entries in HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shellex\ContextMenuHandlers? To answer your question, no, ShellAnything does not read or write to this location in the registry unless you register or unregister the shell extension with unregister.bat, or register.bat.

Yes.. First "shell" entries and then "shellex\ContextMenuHandlers".. And also counts where in the registry they're loaded from. If I'm not mistaken "Classes\Directory" goes before "Classes\Folder". However, there's also the possibility that this order can be overridden in shell extensions, but I'm not sure at this time.

However, if you try to unregister, the shell extension will expect the registry key to be named ShellExtension.ShellAnything and will probably fail to delete the key ShellExtension.ShellAnything and also fail to unregister itself from the system. This will be a problem if you want to upgrade to a newer version of the extension.

Ok. I tested this. I unregistered the ShellAnything extension (having the renamed registry key) and it was done correctly. As you mentioned the "aShellExtension.ShellAnything" key was NOT REMOVED, but the extension was SUCCESSFULLY UNREGISTERED and context menus DISAPPEARED. Then I registered again ShellAnything and the "ShellExtension.ShellAnything" registry key was created again, so now there were two registry keys for ShellAnything but only one context menu, and is loaded in the position of the first appearance in the registry (the one I renamed). I checked loaded shell extensions in the system and "ShellAnything Class" is loaded only once. So it's posible it would be harmless to have both registry keys, but I could just update the register script to remove duplicated entries for ShellAnything.

Just to be clear, are you asking to rename the extension to aShellExtension.ShellAnything within the source code ? That is a possibility.

No. I don't think it would be a good idea to rename the application registry key to satisfy one user's request. Some users might want it on top, others right where it is. I do think other users might find this information relevant (that it is indeed possible to change the menu position but not supported). I was asking in case there was such an option to rename the key or change the context menu location. But I got the answer, and a workable solution.

However, it is only temporary. It will "work" until you register a shell extension named 1foobar which will create menu entries before ShellAnything.

I try to keep my context menus as clean as possible. I have a script that keeps disabled a bunch of shell extensions in the registry. Anyways, in this case I just want ShellAnything menus to appear above the antivirus and a separator.

I would like to keep this issue specific to "moving the location of Configuration and Logs directories". Other considerations should be tracked in a different issue. No offence but its a lot easier for me to plan changes in the software.

Understood!.

Regarding the "Logs" directory, I still think it would best if it was located within LOCALAPPDATA. If I'm not mistaken I think it could be implemented with one (or a few) lines of code.

[== 2 ==] Unfortunately, that is a feature that is not supported by ShellAnything at the moment. I do not see any problem implementing such a feature. For example, the <exec> action could have a new attribute called console that accept values such as true or false. It would be very similar to the KuShellExt example above. I suggest that you open a new issue for tracking this feature. I would also appreciate a little help with this and would gladly accept a pull request that implements such a feature.

Ok. I will definitely create the new issue.
This is a very important feature, not just for me.

[== 3 ==] I don't understand your issue. It should work as expected. For example, to see how the whole thing gets expanded, you can display the list of arguments with &quot;${selection.path}&quot; with the following: [...]
I also created the following Configuration example which is using Visual Studio Codium instead of Visual Studio Code (both software have the same code base) . [...]

And clicking on 4 files actually show the expected message: [...] note the " character before and after each files. A space is inserted between files but Windows automatically show the full string as if there were ${line.separator} between each files. That is not the case. After pressing OK, all the files are opened in Visual Studio Codium: [...]

Maybe you are having an issue since your Windows copy is Spanish. Or because the path to "D:\USER\OneDrive\Programs\VSCode\Code.exe" is incorrect. Its hard to say from my point of view. The message you see in the logs is one reported by your Operating System, not from ShellAnything. I suggest you try again. Also debugging visually with the <message> action could also help. You can press CTRL+C on the popup displayed by a MessageBox (<message>) which will copy the content of the MessageBox as text. This is usefull to validate if the paths displayed in the message are correct. You can also try to "paste" the result (including the double quotes) in a command prompt and see if VSCode is launched and actually opens all the files in the arguments.

A Halloween Mystery. Every path I try work when there's only one argument sent, but fails when there's more than one.
Perhaps I'm making a dumb mistake somewhere. I'll try again next week. I did a list of things to try with the extension.
However, it does highlight (perhaps) it would be a good idea to simplify the handling of multiple arguments.

Looking at how many menus you have in your screenshot above, I have no doubt about this! I have created #109 as a suggestion to reduce the amount of logging. I suggest you add a comment for feedback or another idea to solve the problem in order to keep track of the progress about this problem and receive a notification when it will be resolved.

To be clear. When I said "verbose" I meant for the config file, specifically for the use of three lines in the XML file in order to be able to handle multiple arguments, each time.

I believe ${selection.path} should handle the use of quotes when there are any spaces in arguments, or at the very least a new var (like ${selection.paths}) should. Just a thought.

Respectfully, I disagree since I do not think this is necessary. Like I said in 3, please try again. Other users has confirmed this issue working on their side. See #87 and #52 for details. If the issue persist, create another issue and I will request help from other users that have a non-English Windows. I have also created #110 which once available, could help other in the same situation. Again, I suggest you add a "dummy comment" just to get a notification when it will be resolved.

Ok. I understand.
However, even if I make it work, I do believe the handling of arguments should be simpler.

Thank you again for all your help and suggestion. It is much appreciated. I did not know about KuShellExt before I started this project. I am glad to see that most features can be mapped to ShellAnything because people seems to be migrating from KuShellExtension to ShellAnything. This means the application is "mature" (kind of) and can be used by a lot a people - from multiple locations - speaking different languages.

Thank you, for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants