B4J Question [solved] Contextual menus (ex: right click on a file name on Windows)

valentino s

Active Member
Licensed User
On Windows I would like to add or remove a contextual menu to every file, executing my b4j program, leaving the default application as it is.

It's better to use b4j (but I don't know why) or searching for external tools (installers like innosetup) to configure such features ?

Thank you all in advance.
 

amykonio

Member
Licensed User
You mean you want to add a context menu for specific file type, but only when your application runs?
 

valentino s

Active Member
Licensed User
You mean you want to add a context menu for specific file type, but only when your application runs?
No. On your desktop, right click on a file. The menu has some items. I want to add a new one, indipendently from the extension, and it is not the default application, and the app can not running.

 

DonManfred

Expert
Licensed User
https://stackoverflow.com/questions...ext-menu-item-to-windows-explorer-for-folders

The attached reg file adds a "Open JavaApp" to the contextmenu

Extract the reg-file from the zip and use RightClick on the REG file and choose Add (or whatever it is named in your system). Goal is to add it to your registry.

Note to edit the paths to match the correct ones on your system.

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\shell\Open JavaApp]
[HKEY_CLASSES_ROOT\*\shell\Open JavaApp\command]
@="C:\\Java\\jdk-11.0.1\\bin\\java.exe --module-path C:\\Java\\jdk-11.0.1\\javafx\\lib --add-modules=javafx.controls,javafx.fxml,javafx.web -jar %1"
 

Attachments

Last edited:

valentino s

Active Member
Licensed User
Ok, this confirms I have to work on Windows Registry.

Here some discussions:

- A wish: https://www.b4x.com/android/forum/threads/write-to-windows-registry.73999/#content
- - read 1: "you can make this happen with jshell and cmd easier than writing a new library for this" also here: https://www.b4x.com/android/forum/t...m-is-running-under-windows.36830/#post-216752
- - read 2: "You can write to registry with jAutoItX: https://www.b4x.com/android/forum/threads/jautoitx-library.37539/ "
- - read 3: "similar to this https://www.b4x.com/android/forum/threads/execute-windows-vbs-scripts-from-b4j.73612/ "
- Reading and writigin:
- - read 4: https://www.b4x.com/android/forum/threads/reading-windows-registry.46189/#post-285252
- - read 5: library windows specific: https://www.b4x.com/android/forum/threads/reading-windows-registry.46189/#post-285252

Or, probably, it's easier using inno setup. http://www.jrsoftware.org/ishelp/

I'm, pretty confident there's an option to add a new voice. I didn't find yet, there are ton of options.


HERE THE SOLUTION using INNO SETUP:

- edit registry with inno setup: https://stackoverflow.com/questions/26536030/file-association-in-inno-setup
- Create a new item in the Windows context menu
http://www.vbforums.com/showthread....ight-clicked&p=4641103&viewfull=1#post4641103
- "The process of adding custom verbs to a file's shortcut menu is described in the Extending Shortcut Menus and Verbs and File Associations topics. If you prefer a simpler way, you can also just put a shortcut to your EXE in the SendTo folder." in http://www.vbforums.com/showthread....ight-clicked&p=4641103&viewfull=1#post4641103
- "Inno Setup - Create shortcut in “Send to” context menu" : https://stackoverflow.com/questions/39448367/inno-setup-create-shortcut-in-send-to-context-menu
- documentation: http://www.jrsoftware.org/ishelp/index.php?topic=iconssection

UPDATE: to create an .exe can be useful also: https://www.b4x.com/android/forum/t...-a-36kb-run-exe-file-which-doesnt-run.109303/
 
Last edited:
Top