Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 10, 2016, 12:29:55 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: tiny right-click shell extension for Sysinternals' Contig (defrag)  (Read 7520 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,136
    • View Profile
    • Donate to Member
Hi!

Could anyone please code something so I could use http://www.sysintern...tilities/Contig.html by simply right-clicking a file and choosing "Defrag with Contig" from the context menu?

Right-now I'm using the Power Defragmenter GUI for Contig but would like a faster approach to defrag single files.
« Last Edit: February 23, 2006, 03:13:27 AM by brotherS »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: wanted: tiny right-click shell extension for Sysinternals' Contig (defrag)
« Reply #1 on: February 21, 2006, 03:45:12 AM »
I don't know how to do shell extensions, but i think you could do that with the "send to" right-click menu, it's very easy, and would spare the anoyance of having yet another item on the right-click menu that you'll use rarely (IMO).

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,136
    • View Profile
    • Donate to Member
Re: wanted: tiny right-click shell extension for Sysinternals' Contig (defrag)
« Reply #2 on: February 21, 2006, 03:53:39 AM »
Hmm, "send to" pops up a list of lots of folders and files here, I thought my suggestion would be a cleaner solution. I don't mind having one more item in there, but if you have an easy "send to" solution, I'm willing to test that too.

Thanks :)

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: wanted: tiny right-click shell extension for Sysinternals' Contig (defrag)
« Reply #3 on: February 21, 2006, 04:01:05 AM »
Creating a "send to" menu item is trival, you just go to "%documents and settings%/%user%/send to", and create a shortcut there for the executable.
Then, you edit that shotcut's properties, and add the parameters to the "destiny" field.
That should make it ;)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,136
    • View Profile
    • Donate to Member
Re: wanted: tiny right-click shell extension for Sysinternals' Contig (defrag)
« Reply #4 on: February 21, 2006, 06:14:36 AM »
Thanks, sounds easy :)

Edit: I killed and restarted Explorer.exe, but I seem to reboot Windows to activate that change to "send it" :(

Edvard

  • Coding Snacks Author
  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Posts: 2,888
    • View Profile
    • Donate to Member
Re: wanted: tiny right-click shell extension for Sysinternals' Contig (defrag)
« Reply #5 on: February 22, 2006, 11:47:09 AM »
Okay, open Regedit
Go to HKCU/*
If there is not a key named "Shell" there, make one.
Inside "shell" make a key named "contig" and modifiy it's value to "Defrag with Contig"
Inside "contig" make a key named "command" and modify it's value to "path/to/contig" "%1"
(include quotes and spaces, and replace path/to... with YOUR path to your copy of Contig)
That will put it in your context menu for files. Now for folders...
Go to HKCU/Folder/shell and do the same except under "command" modify it's value to "path/to/contig -s" "%1\*.*"

OR

copy/paste this into a .reg file and Merge:
(just make sure you edit it to use YOUR path to contig.exe if this is not the same, and omit or edit the folder bit. I have written it to defrag the folder contents and recurse to subdirectories)
REGEDIT4

[HKEY_CLASSES_ROOT\*\shell\contig]
@="Defrag with Contig"

[HKEY_CLASSES_ROOT\*\shell\contig\command]
@="\"C:\\Program Files\\SysInternals\\Contig\\Contig.exe\" \"%1\""

[HKEY_CLASSES_ROOT\Folder\shell\contig]
@="Defrag with Contig"

[HKEY_CLASSES_ROOT\Folder\shell\contig\command]
@="\"C:\\Program Files\\SysInternals\\Contig\\Contig.exe -s\" \"%1\\*.*\""

One could even make an AutoHotkey script that would install/uninstall, but that may be going a bit too far...

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,136
    • View Profile
    • Donate to Member
DONE: tiny right-click shell extension for Sysinternals' Contig (defrag)
« Reply #6 on: February 23, 2006, 03:12:59 AM »
Thanks, both of you!

I'm now using AutoHotkey to do the complete job. This script defrags the file and shows the result in your standard editor:

;2006-02-23
;defrag with Sysinternals' Contig http://www.sysinternals.com/Utilities/Contig.html
:*b0:.defrag::
InputBox, Defragpath, Defrag, enter full path of the file to defrag, ,420, 118
RunWait, %comspec% /c Contig -q "%Defragpath%" > summary.txt, C:\Programme\Contig Defrag\
Run, C:\Programme\Contig Defrag\summary.txt
return