• Advertisement
Sign in to follow this  
  • entries
    94
  • comments
    127
  • views
    83409

Simple context-menu extension. Part 1 - commandline tool redirection

Sign in to follow this  

357 views

Updated 2006-02-16: In step 10, it should be 85%% and not 85%. % works as the escape character \, if you want that actual character you'll need two.

What?
Do you have some command line you usually use with files? Like HL2 modding where you have to compile the model through a commandline, or creating fixed-sized thumbnails of images to put on your website? Well if it's a copy-paste action you use alot, then you can easily add it to the context menu in Windows Explorer! It doesn't involve any programming nor Windows Registry hacking! The joys!

It has one drawaback though, you won't get the same flexibility as opening the command console. But then again, you're not programming or anything so this simple solution gives you a simple tool. Duh! =P

How?
I'll illustrate by adding a menu item to explorer that let's you compress any JPEG image to 85% quality just by right clicking on it. Something I do frequently when I'm uploading photos.

I read this article and used ImageMagick that has a convert utility app, so you'll need to download ImageMagick (binary, i.e. precompiled) before continuing.

I have Windows XP; so basically, I went into the file explorer and did this (see reference pic below):

  1. Tools -> Folder Options

  2. *click the File Types tab*

  3. *select JPG*

  4. *click Advanced* (if the button Advanced isn't visible, you probably see a "Default" button - meaning you've changed the default behaviour of JPGs somehow, like installing a image app. I just clicked that and the text changed to "Advanced")

  5. -new window opens-

  6. *click New*

  7. -new window opens-

  8. *write the text for the menu item, like "Quality to 85%"*

  9. *click Browse and navigate to your ImageMagick root folder, select convert.exe*

  10. *add "%L" -quality 85%% "%L" after the file path* (%L is a system variable to the filepath of the file you right-clicked on, we use quotes because the file path might include spaces)


Here's some visual aid:



The actual command line, in my case, is:
"C:\Program Files\ImageMagick-6.2.5-Q16\convert.exe" "%L" -quality 85%% "%L"
Including all the quotes!

End
This is what you should end up with.


YAY!!

I hope to get started on my next project in December. Just have to finish Bling! first hehehe... or maybe not!

Thanks goes out to muer, snk_kid, Washu and DigitalDelusion for proofreading this. Extra thanks to snk_kid for the english Windows XP screeny.
Sign in to follow this  


2 Comments


Recommended Comments

Thats pretty cool, it would be even better though if it was like this:
Change Quality >>

90%
80%

10%

Share this comment


Link to comment
Hush! You're exposing my plans! ;)

As I said, this is a quick hack to do something quick. I don't think it's possible to add submenus in the context menu without hooking up a COM object and messing with the windows registry. If I'm wrong, please let me know.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement