Posts tagged ‘Linux’

Convert .chm to .pdf using HTMLDOC on Ubuntu

Microsoft Compiled HTML Help (.chm) is a Microsoft proprietary online help format. It was introduced as the successor to Microsoft WinHelp with the release of Windows 98, and is still supported in Windows 7. [..]

Now since it is a proprietary format, so Linux does not have any (none that i am aware of) applications which support this format. So it is required to first convert it into the .pdf format to make it readable in Linux.

Converting a .chm file to a .pdf file is a very simple process.

Install CHMLIB

#sudo apt-get install libchm-bin

Extract .html files out of .chm file

#extract_chmLib book.chm dirname
– – – – – >##book.chm = name of the .chm file.
– – – – – > ##dirname = name of the directory where you want .htmls to be extracted.

Install HTMLDOC

#sudo apt-get install htmldoc

Convert .htmls to .pdf using htmldoc

#htmldoc

Add all the extracted .htmls into htmldoc and convert it to .pdf.

HTMLDOC

“Send To” script for Nautilus in Ubuntu

So for all those people who have always been Windows users and now want to move to Linux, there are some things which we miss a lot in Linux or want in Linux.

The “Send To” menu is one of them. I used to miss it a lot as well, but not anymore. I wrote a Nautilus Script to add the “Send To” menu to my Nautilus right click menu.

Here’s the steps to get your own custom “Send To” menu item in Nautilus :

First of all move to the following folder

                                $cd ~/.gnome2/nautilus-scripts

Then create a file in this folder and name the file whatever you want your menu item to be

                                $touch “Send To”

Add the execute permission for this file

                                $chmod +x “Send To

Edit this file and add the following code in this file

                                #!/bin/bash
                                ## Authur : Sushant Bhosale <sushantbhosale91@gmail.com>
                                IFS=$’\n’
                                cd ~/
                                gnome-terminal –command=’./list.sh’
                                exit 0

Now go to the home directory and create a file named “list.sh” and add execute permission to it

                                $cd ~/

                                $touch list.sh

                                $chmod +x list.sh

Edit “list.sh” and add the following code in the file

                                #!/bin/bash
                                ## Author : Sushant Bhosale <sushantbhosale91@gmail.com>
                                IFS=$’\n’
                                cd /media/
                                array=(`ls`)
                                len=${#array[*]}
                                i=0
                                while [ $i -lt $len ]; do
                                                                echo “$i: ${array[$i]}”
                                                                let i++
                                done
                                echo “Enter the folder to copy: “
                                read ch
                                for FILENAME in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
                                do
                                                                cp $FILENAME /media/${array[$ch]}
                                done
                                exit 0

Just save and copy with just few clicks. . .

Another good feature of this script is that it asks the user for the drive to copy file to, so you can use it to copy file to any mounted drive.

The reason for using two scripts is that nauitilus-script runs in background instead of in a terminal, but we needed the user input in this case so had to use two scripts.

I’ll upload the files here for downloading, link at the bottom of the post.

"Send To" in Right Click

Enter the Drive to copy the file into.

Note : WordPress won’t allow me to upload .txt or .sh file so I changed the extension to .doc, just change it back to .sh prior to downloading.

Here’s the link for “Send To” file. Rename this file from “Send To.doc” to “Send To”

Here’s the link for “list” file. Rename this file from “list.doc” to “list.sh”.

“Add To Playlist” in Ubuntu

For a long time now I have been using Ubuntu 11.04 (with Unity) as my primary OS. I like to listen to music and I use Audacious as my default audio media player whose official website is here, but the website is not informative so you can find more information about it here on wikipedia.

One issue in Unity is that drag and drop is not easy (or maybe it is!!! in the stable release. but since am using alpha release it doesn’t really work for me). So whenever I want to listen to songs and want to add them to my Audacious playlist I have to do a lot of minimizing and maximizing. I was an Windows user so I always used Winamp on windows, which by the way allows to add songs into the playlist just by right clicking on them. I always wanted this feature on Linux. But no software supported this.

So I decided to take issues in my own hands. I found a script about adding the menu item when you right click on a file. And I used it to execute a script which adds that file to the current playlist in Audacious :).

Here’s the steps to get your own custom “Add to Playlist” menu item in Nautilus :

First of all move to the following folder

                                #cd ~/.gnome2/nautilus-scripts

Then create a file in this folder and name the file whatever you want your menu item to be

                                #touch “Add to Playlist”

Add the execute permission for this file

                                #chmod +x “Add to Playlist”

Edit this file and add the following code in this file

                                #!/bin/bash

                                ## Sushant Bhosale <sushantbhosale91@gmail.com>
                                ## The code is Free and Open Source

                                IFS=$’\n’                                                                ##IFS(Internal Field Separator), Google for more info.

                                for FILENAME in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
                                do
                                                                audacious2 -e “$FILENAME”
                                done

                                exit 0

Save and enjoy!!!

Add To Playlist