Blog Archives

Unofficial Chrome Extension Manager Enables or Disables Add-ons [Downloads]

Windows only: Until Google graces us with a real extension manager, an enterprising user put together an impressive batch file that can handle enabling, disabling, or even uninstalling Google Chrome extensions.

Once you've downloaded the batch file, you can simply double-click to open it up in a command prompt window, where you'll be presented with a menu that allows you to enable, disable, or uninstall extensions, or even run Chrome with extensions enabled. It's definitely not the ideal way to deal with add-ons, but it's a great, workable solution until Google puts a real extension manager together—and you have to admire those kind of batch scripting skills.

Hit the link for the download, and remember to right-click the batch file download link and Save As, giving the file a *.bat extension.





MyDefrag Optimizes Files On Your Hard Drive [Downloads]

Windows only: Freeware defrag utility MyDefrag not only handles the basic drive defragmentation tasks, it also includes a powerful scripting engine, a screensaver, and a command-line version.

MyDefrag is based on the previously mentioned JkDefrag utility, but there's no regular options dialog for MyDefrag—instead, a set of included scripts handles a variety of defrag tasks immediately, but can be customized to perform much more advanced tasks. For instance, if you wanted to move all your music files to the fastest part of the disk, you can do so easily with a simple script—it's probably not the best choice for the less tech-savvy reader, but the powerful command-line scripting options are very welcome.

MyDefrag is a free download for Windows only. For more, check out the five best Windows maintenance tools.





Open a New Command Prompt from Explorer with a Hotkey [Autohotkey]

Reader Kevin used his ubergeeky AutoHotkey scripting skills to create a hotkey that opens a command prompt window at the same location as the folder you are browsing in Windows Explorer.

To use the script, you simply hit the Ctrl+Alt+H shortcut key sequence while looking at a folder in Windows Explorer and a new command prompt window will open, already set to the same working directory. We’ve already covered how to open a command prompt window from the context menu, but this method is even simpler.

To create this hotkey for yourself, create a new AutoHotkey script or add the following to your existing script:

#IfWinActive ahk_class CabinetWClass ; for use in explorer.
^!h::
ClipSaved := ClipboardAll
Send !d
Sleep 10
Send ^c
Run, cmd /K "cd `"%clipboard%`""
Clipboard := ClipSaved
ClipSaved =
return
#IfWinActive

Once you’ve added, saved, and launched the script, you should be able to start using the hotkey immediately. Thanks, Kevin!

For more Windows shortcut goodness, check out how to make Win+E open the folder of your choice, learn how to use Caps Lock for hand-friendly navigation, and see how Taskbar Overlord tweaks the Windows 7 taskbar. Brand new to AutoHotKey and its time-saving ways? Peek at our beginner’s guide to learn how to add this script, or write your own.





Glass CMD Enables Aero Transparency for the Command Prompt [Downloads]

Windows only: Tiny application Glass CMD for Vista forces command prompt windows to use Aero’s glass transparency effect.

Once you’ve downloaded and launched the no-install-required application, simply open a new command prompt window and the transparency effects should be immediately enabled. The application lives in the system tray, but takes up less than 1MB of RAM on our test system so it’s unlikely to drain your resources.

Glass CMD for Vista is free and open source, works on Windows 7 or Vista. The application is written in the AutoIT scripting language, but an enterprising reader could convert it to AutoHotkey or simply include the source in an existing script.





Kill Frozen Windows Apps Easily [Windows Tip]

If you've used Windows for any amount of time, you've already had to deal with the dreaded (Not Responding) frozen application—so instead of using task manager, why not create a shortcut to auto-kill them?

The HaxAttack weblog writes up a great tip to create a batch file that automatically kills any applications with a status of Not Responding, but you can actually just create a shortcut directly, omitting the batch file altogether.

To create your own quick-killing mechanism, just create a new shortcut anywhere, using this as the location:

taskkill.exe /f /fi “status eq not responding”

Once you are done, you can change the icon, or even assign a shortcut key in the properties dialog—just make sure the shortcut is on your desktop or in the start menu if you want the hotkey to work, since Windows hotkeys don't work in the Quick Launch. Thanks, Cyrus!

For more, check out how to kill runaway processes with Task Killer, previously mentioned ClickGone, or simply use the very powerful Process Explorer.





Use a Different Color for the Root Shell Prompt [Terminal Tip]

Linux only: Reader Chris writes in with an excellent tip that changes the prompt to red when using the root account from the terminal—as a reminder to be more careful.

Using the tip is relatively simple—just edit the /root/.bashrc file and add in the following, preferably commenting out the existing lines that set the color, though you can simply add this line to the end of the file.

PS1='${debian_chroot:+($debian_chroot)}[33[01;31m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '

Once you’ve added this line, anytime you switch to using the root shell you will see the prompt in red with white text for the command line. Chris takes it further, with a line that turns the prompt green for regular users, which you can enable by adding the following to your ~/.bashrc file:

PS1='${debian_chroot:+($debian_chroot)}[33[01;32m]u@h[33[00m]:[33[01;34m]w[33[00m]$ '

This tip can really come in handy if you have a bunch of terminal windows open at once, so you can tell at a glance which ones are using root mode and which aren’t. Thanks, Chris!

For more tips on powering up your terminal, check out how to display your public IP address, show a list of only subdirectories, or make any directory into an ISO file.





Email Yourself Reminders From Launchy [Ubergeek]

Reader Ryan writes in with his ubergeeky method for sending emails to himself directly from Launchy—a very useful trick to quickly send yourself reminders.

To accomplish this hack, Ryan assembled a visual basic script (VBS) file that sends the email using Gmail's SMTP server—the email addresses are hard-coded but the subject line can be entered directly in Launchy.

If you want to use this trick for yourself, there's just a few steps to follow along—first, create a new *.vbs file and paste in the following contents, modifying the bold text with your own values.

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
schema = "http://schemas.microsoft.com/cdo/configuration/"
Flds.Item(schema & "sendusing") = 2
Flds.Item(schema & "smtpserver") = "smtp.gmail.com"
Flds.Item(schema & "smtpserverport") = 465
Flds.Item(schema & "smtpauthenticate") = 1
Flds.Item(schema & "sendusername") = "MYACCOUNT"
Flds.Item(schema & "sendpassword") = "PASSWORD"
Flds.Item(schema & "smtpusessl") = 1
Flds.Update

With iMsg
.To = "EMAILADDRESS"
.From = "NAME <EMAIL>"
.Subject = wscript.arguments.item(0)
.HTMLBody = message
.Sender = " "
.Organization = " "
.ReplyTo = " "
Set .Configuration = iConf
SendEmailGmail = .Send
End With

set iMsg = nothing
set iConf = nothing
set Flds = nothing

Now that you have your script created and ready to go, open up Launchy’s Plugins tab in the options panel, and create a new Runner command pointing to the script. The key step here is to use "$$" in the arguments field—the quotes are important!

Since the example uses “tome” as the command, you can just type “tome” into Launchy, hit the tab key, and then type the subject of the email message. If all goes well, you should see a new email in your Gmail account with the same subject line.

This tip can be used for much more than just sending yourself emails, however—you can make a copy of the script and adjust the To field to quickly send emails to Remember the Milk or any number of other services that accept new items via email. You could even modify the script further to pass in further parameters to your RTM tasks if you really wanted to get geeky with it.Thanks, Ryan!

If you’d rather use your web browser, you can open a new Gmail compose window directly from Launchy. For more on Launchy power tips, read our feature on taking Launchy beyond application launching.





[Sponsored]


Guantanamo Bay is one of the world's controversial prisons. This may be its final chapter. With unprecedented access, National Geographic has the story you haven't heard. Both sides, told from the inside, before its doors close forever. Click to learn more and go Inside Guantanamo >>
natgeotv.com/guantanamo

 

MinTTY Gives Cygwin a Native Windows Interface [Downloads]

Windows only: If you need your Unix command line on a Windows PC, chances are you use a terminal emulator like Cygwin—and if you do, you want to check out MinTTY.

The MinTTY terminal window for Cygwin puts a native Windows interface on Cygwin which offers more keyboard shortcuts and colors and styles. Check out the difference between Cygwin and MinTTY side-by-side in the thumbnail on the right. Using MinTTY you can turn on window transparency, set your font, and colors, copy and paste output by just selecting it with your mouse, and scroll up using the Shift+arrow key combination. (Once it’s installed, right-click on the MinTTY window and choose Options to customize it’s look and keyboard shortcuts.) Here’s what the full MinTTY window with transparency turned on looks like.


Install MinTTY either in Cygwin’s setup (find it under Shells) or get the standalone download from MinTTY’s homepage. The downside to MinTTY? It doesn’t include a tabbed interface and the developer doesn’t plan to add tabs, either. Still, MinTTY’s a big upgrade for anyone who spends time with Cygwin. After MinTTY’s installed, choose its shortcut instead of Cygwin’s from your Start menu. MinTTY is a free download that works with Cygwin for Windows only.

If you’re a beginner interested in learning a bit about Unix in Windows through Cygwin, check out my three-part series of tutorials:

Smarterware is Lifehacker editor emeritus Gina Trapani’s new home away from ‘hacker. To get all of the latest from Smarterware, be sure to subscribe to the Smarterware RSS feed. For more, check out Gina’s weekly Smarterware feature here on Lifehacker.





Cut the Bash Prompt Down to Size [Terminal Tip]

The LinDesk weblog runs down the process of customizing the shell prompt to trim the current path down to a reasonable character limit—making typing long commands much simpler while under deeply nested folders.

The guide includes a number of options for customizing your prompt to include more information about the current path without overloading your screen with characters—one of the more interesting tweaks is this script that removes characters from the middle of the path, which will cut down the size while clearly identifying the current folder. To test it out, you can simply paste the following text into the terminal prompt:

PROMPT_COMMAND='DIR=`pwd|sed -e "s!$HOME!~!"`; if [ ${#DIR} -gt 30 ]; then CurDir=${DIR:0:12}...${DIR:${#DIR}-15}; else CurDir=$DIR; fi'
PS1="[$CurDir] $ "

Hit the link for the walk-through and alternate prompt options, or you can customize your terminal greeting and reduce your terminal clutter with screen.





Todo.txt CLI Manages Your Tasks from the Command Line [Lifehacker Code]

Dozens of fancy point-and-click task managers promise to organize your to-do list, but so often power users find that nothing outdoes that trusty old classic: the todo.txt file.

If you’re a command line lover who skips checkboxes and drop-downs to dash off notes and tasks in a regular old text file, or you’re intrigued by the idea and wish your todo.txt chops were stronger, read on.

I’ve been a heavy todo.txt user for years. Back in 2006, I started developing a command line interface (CLI) to my todo.txt which lets me add to and check off items without launching a full-on text editor. Three years of daily (or at least weekly) use later, version 2.0 of the script is now available. It offers basic to advanced commands for managing your todo.txt and other text files you might use to capture information, like ideas.txt or maybelater.txt. Let’s take a look.

Who This Is Meant For: If you’re comfortable working in the terminal, changing permissions on a file, and working with Unix-style text commands, then the todo.txt CLI is for you. If you don't spend a good amount of time at the command line—either in the Terminal on your Mac, or using a Unix command line or emulator on Windows—you're going to think this whole thing is arcane and confusing. (In that case, we highly recommend getting organized with Remember the Milk. If you want to boost your command line chops on Windows, check out our introduction to Cygwin.)

You’ve already got CLI religion? Good. Let’s get started on some hot todo.txt command line action.

Quick Start Guide:

  1. Download the Todo.txt CLI 2.0 zip file and extract it. You’ll get two files. Place both todo.cfg (the configuration file) and todo.sh in your home directory.
  2. Open the todo.cfg file with your text editor of choice. Set the TODO_DIR variable to the right path for your setup. For example, on my Windows PC, this line reads:
    TODO_DIR="C:/Documents and Settings/gina/My Documents"
    On my Mac, this line reads:
    TODO_DIR="/Users/gina/Documents/todo"
  3. Make the todo.sh file executable by using the command: chmod +x todo.sh
  4. (OPTIONAL) Alias the letter t to todo.sh to save keystrokes while you use it. In your ~/.bash_profile file, add the line:
    alias t='~/todo.sh'

Now you’re ready to put this script to work!

Basic Usage

Before we start, keep in mind that this CLI isn’t trying to reinvent the text editor. If you want to do big bulk edits to a lot of items in your todo.txt, just open it up in your favorite text editor to do so. But for quick, one-hit access to add items, mark items as complete, or slice and dice your list by project or priority, todo.sh is for you.

For example, to add a line to your todo.txt file, at the command line, type:

$ t add "Pick up milk"

Add a few more items for good measure:

$ t add "Pick up the dry cleaning"
$ t add "Clean out the inbox"

Now, to see all the items on your list, use:

$ t ls

The output will look like this:

$ t ls
03 Clean out the inbox
01 Pick up milk
02 Pick up the dry cleaning
--
TODO: 3 tasks in C:/Documents and Settings/gina/My Documents/todo.txt.

Now, you can reference each item by its ID—which is actually the line number it lives at in the todo.txt file. For instance, to prioritize task 1 to the highest level—priority A—use this command:

$ t pri 1 A

To mark task 2 as complete, use todo.sh‘s do action:

$ t do 2

Since a video is worth a million words, see this in action in this screencast demonstration of a to-do list you might find for a crew member on Battlestar Galactica. (Go full-screen to see what’s being typed more clearly.)

If this video clip isn’t clear enough for you, try this alternate high-res location.

Advanced Usage

Once you’ve got the basics of working with your todo.txt down, it’s time to dive into more advanced tricks. Here are a few more things this CLI can do.

  • Replace or delete a task; append or prepend text to a line. When you want to re-word a task or add a context, project, or additional info to it, use the replace, append, and prepend actions to do so. For example, add “ready at 3PM” to your “Pick up the dry cleaning task” with this command:

    $ t append 2 "ready at 3PM"

  • See all the contexts and projects in your list. If you’re using the + and @ sign format to signify projects and contexts, use the listcon and listproj (or lsc and lsprj for short) commands to see a short list of all your contexts or projects in your todo.txt.
  • Move items from your todo.txt to another text file. Say you've decided that the "Learn how to speak French" task is actually something you're not quite committed to doing—yet. Use todo.sh‘s mv command to zip that task from todo.txt to another text file in your todo directory. For example, this command will move it into a maybelater.txt file:

    $ t move 10 maybelater.txt

  • List the contents of another text file. Since I got so used to working with todo.txt this way, there’s now support for working with other text files. For example, you can list the contents of your maybelater.txt file using the command:

    $ t listfile maybelater.txt

    Likewise, you can add a line to another file using:

    $ t addto ideas.txt "My bright idea"

    You can also search the contents of another text file by adding a keyword after the list command, ala:

    $ t lf ideas.txt apple

See all the options available to you using the todo.sh -h command. The full usage manual is available here.

Further Info and Related Projects

The todo.txt CLI has lived over at its official homepage, Todotxt.com, for years now, and although I haven’t posted an update there since 2006, an active mailing list of over 500 members is still going strong. Since this project is open source, happily several other todo.txt projects have sprung up over the years, including Task, which offers even more features than my little script does.

If you’re a programmer who wants to add to this script or a user with questions or ideas about the todo.txt CLI, either post them here or consider joining the mailing list for support. For a full history of this script's development—including its three-year hiatus—see its full changelog.

Think using a command line interface to a text file is insane or fantastic (or both)? Tried out todo.txt? Tell us what you think in the comments.

Gina Trapani, Lifehacker’s founding editor, is still married to her todo.txt file even after a sordid affair with Remember the Milk. Her weekly feature, Smarterware, appears every Wednesday on Lifehacker. Subscribe to the Smarterware tag feed to get new installments in your newsreader.






WP Like Button Plugin by Free WordPress Templates