Login Register


Tutorial [Serenity] Adding scripts to context menu (Windows) filter_list
Author
Message
[Serenity] Adding scripts to context menu (Windows) #1
I haven't slept in 24 hours, so naturally, I've learned a shitton and decided to post some of my info here. It's a quick tut, but I'll be outlining how to add custom scripts to your right click, or context, menu through editing registry keys.

First, open up a shell of your choice and run the regedit command. You'll get an admin prompt, so accept and continue.

From here, there's a choice we need to make. If you want a static command that shows up when clicking on your desktop, navigate to the following key:
Code:
HKEY_CLASSES_ROOT\Directory\Background\shell\

After you're there, create a key named whatever you want the menu item to be, in this case, Steam (because I'm a fucking nerd).
After you've made the key, create a subkey named whatever you want, though I find "command" works well for organization.
Once you've made that, edit the subkey's default REG_SZ value to the full file path of whatever static program you're running.
[Image: TZt0kDO.png][Image: cHp19cL.png][Image: W5yD3yK.png]

Elsewise, if you want the real shit, which is running a dynamic script like the one I'm detailing here (which I'll post in another thread) that takes arguments, navigate to:
Code:
HKEY_CLASSES_ROOT\*\shell\

Once there, go through the same key/subkey creation I outlined in the static method. The only difference is the REG_SZ key's value. Instead of something arbitrary like the steam path, you can run, say, a python script using the below value:
Code:
C:\Python27\python.exe "C:\Users\-\Desktop\Code\-\-\pomfloader.pyw" %1

The reason we need the full path to everything is because the registry has no access to your PATH environment variable, which is what lets you execute python files with just "python script.py".
The second argument, the script's path name, should be in quotes, but doesn't need to be. Just good practise.
The final argument, %1, is Window's version of sys, or process, .argv[1]. Normally, it would stand as a command line argument, but in this case identifies as the selected file, which is convenient. To implement that in your code, just use the aforementioned argv array.
[Image: e3pPCsd.png][Image: t2SU9Ua.png][Image: ggIK4Dk.png]
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.

[+] 1 user Likes Inori's post
Reply

RE: [Serenity] Adding scripts to context menu (Windows) #2
Excellent tut, looking forward to seeing what else Serenity will put out.
[Image: 9JVyFsC.png]
Sig by @Symadox

XMPP: Mi5@DukGo.com

Reply

RE: [Serenity] Adding scripts to context menu (Windows) #3
Very cool. Very cool indeed. Thanks.
"If you look for the light, you can often find it. But if you look for the dark, that is all you will ever see.”


Reply

RE: [Serenity] Adding scripts to context menu (Windows) #4
This looks very good, I will be testing this tomorrow on my Desktop. Thanks for sharing.
~~ Might be back? ~~

Reply

RE: [Serenity] Adding scripts to context menu (Windows) #5
This does In fact work, I've tested It out many years ago.

Prior to editing the registry, I recommend backing It up using the registry's "Export" feature. Any Incorrect editing of critical keys and/or values, may cause significant system Instability and/or loss of functionality.

A very well formatted, elaborated and Illustrated tutorial.
Good job.
[Image: AD83g1A.png]

Reply







Users browsing this thread: 1 Guest(s)