topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • Tuesday October 8, 2024, 5:38 pm
  • Proudly celebrating 15+ 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 12236 times)

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,261
    • 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 AM by brotherS »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
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,261
    • View Profile
    • Donate to Member
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
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,261
    • View Profile
    • Donate to Member
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: 3,021
    • View Profile
    • Donate to Member
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,261
    • View Profile
    • Donate to Member
DONE: tiny right-click shell extension for Sysinternals' Contig (defrag)
« Reply #6 on: February 23, 2006, 03:12 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