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

"Open with" option on context menu #612

Open
chescogala opened this issue Jan 27, 2025 · 9 comments
Open

"Open with" option on context menu #612

chescogala opened this issue Jan 27, 2025 · 9 comments

Comments

@chescogala
Copy link

I have been trying to find documentation on adding an "Open with" option to the context menu, but I can't seem to find anything on this, is it possible to do so with Shell? If so, would it also be possible to make it so that the "Open with" options all relate to the file extension of the file that's being opened?

Thank you

@RubicBG
Copy link
Collaborator

RubicBG commented Jan 28, 2025

https://github.com/RubicBG/Nilesoft-Shell-Snippets/blob/main/ex1.system/all.openwith.simple.ml.nss
you can edit the item by adding a file extension filter with find= or where=

@chescogala
Copy link
Author

I would like it to be like the Windows option that displays a submenu with the available apps to open that file.

Something like this:

Image

I would really like if there was an option already coded since I am not the best at coding.

Thank you

@RubicBG
Copy link
Collaborator

RubicBG commented Jan 28, 2025

I've already tried (twice) to recreate the "Open with" menu with NS syntax, but without success - I manage to match the information which extension should be opened with which programs, but I can't get them to open the file always (80% of the time)

But there is a solution: by modifying the registry to create a second "Open with" menu that will not respect anything other than the extension. This method only works in Win 11 (I've never tried it on another OS version, but I'm 99% sure it won't work).

  • Do you want it as a reg file to activate it once, or as an NS command to activate/deactivate (toggle) it?
  • Do you want this menu also on folders too? background? drivers?
  • Do you want me to edit it a bit with NS syntax?

@chescogala
Copy link
Author

  • What would be the benefit of having it as a reg file, or having it as an NS command to activate? And how would that NS command work?
  • Yes, I would like it to also be on folders, drivers, and anything else that the original context menu would use the "open with" option
  • About the syntax, whatever works best in this case would be perfect

Thank you very much

@RubicBG
Copy link
Collaborator

RubicBG commented Feb 1, 2025

menu(title='make variables local' type='*' expanded='true') {
	$rf	= null 
	$rt	= null
	$re	= null
	$reg_modify = 'reg query "HKEY_CLASSES_ROOT\@re\shell\@rt" >nul 2>&1 && reg delete "HKEY_CLASSES_ROOT\@re\shell\@rt" /f || reg copy "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\CommandStore\shell\@rf" "HKEY_CLASSES_ROOT\@re\shell\@rt" /f'
	$rkey='NewOpenWith'
	$isCheck=reg.exists('HKCR\*\shell\@rkey') and reg.exists('HKCR\Directory\shell\@rkey') and reg.exists('HKCR\Drive\shell\@rkey')
	item(title='Open With' checked=isCheck tip='Add "Open With" to all files, folders, and drives'
		admin cmd-line='/c @{rf='Windows.OpenWith' rt=rkey } @{re='*'} @reg_modify & @{re='Directory'} @reg_modify & @{re='Drive'} @reg_modify' window='hidden')
}
remove(where=this.title==str.res('shell32.dll', -5376) or this.title==str.res('shell32.dll', -5377))
modify(where=this.title==title.open and this.pos>0 image=icon.open_with title=title.open_with+"\t"+'modern')

try it and write back

@Eta-Beta
Copy link

Eta-Beta commented Mar 1, 2025

Good morning, sorry to butt in, but I would be interested in knowing how to have the icons at the top of the menu, with the functions "cut, copy, rename, paste". Much more practical than having separate entries. Perhaps it is the only good idea of ​​the new Windows 11 menu.

@RubicBG
Copy link
Collaborator

RubicBG commented Mar 2, 2025

not possible with the current version

@Eta-Beta
Copy link

Eta-Beta commented Mar 2, 2025

Good morning, thank you very much for your reply. Seeing the image inserted by "chescogala" I thought it was Nilesoft with the icons at the top, as I said about the new Windows menu maybe it's the best thing they've done, even if I normally use keyboard shortcuts it's convenient to have them at the top, like small icons.

@RubicBG
Copy link
Collaborator

RubicBG commented Mar 2, 2025

#425 (comment)

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

3 participants