Random Monday : Fun with Batch Files - Converting PDFs to TXTs

I was fiddling with Kryloff Technologies’s GetText last week to export the first 100 issues of Computer Gaming World to TXT format to read on my mobile phone using TequilaCat Book Reader, when I realized that repeatedly typing and then cutting and pasting commands at the Command Prompt 100 times isn’t a good idea to spend a precious weekend. Admittedly, the plain TXT format isn’t the best way to enjoy these treasures but I’ve little time to read except on the way to work :(

Now writing a program to do this in C# .NET in which I write code at work would be a trivial task but it seems like overkill for such a simple task, so I decided to brush up on my rusty knowledge of DOS commands to automate or at least semi-automate this process.

Do read on if you’re interested to understand how the batch files work, otherwise simply scroll to the bottom of this post to download the premade batch files to convert either a single file or a folder of PDFs to text.

Now creating a batch file (a TXT file with a BAT extension) with the following command:

%~dp0gettext.exe %1 %1.txt

and dropping it into the GetText folder quickly allows me to drag and drop any PDF (or in fact any file convertible by GetText) onto the batch file and immediately convert it to a .TXT file in the same directory as the file to convert.

%~dp0 is substituted with the full path of the batch file without the filename of the batch file which essentially points to the full path of the GetText application.

%1 refers to the file being dropped onto the batch file. For some systems, I found that I needed to enclose %1 with double quotes to cater for paths with spaces in them whereas other systems handle long file names without needing double quotes.

Now automatically converting a single file isn’t too shabby but it’s still not good enough. Dragging and dropping 10 files is OK but not 100 :( So I Googled for some resources and found Rick Lively’s Command Reference, a handy guide for all DOS/Command Prompt commands together with notes and examples.

Now armed with a FOR loop from this reference, I created another batch file to process all the files in a folder.

for %%f in (%1\*.pdf) do %~dp0gettext.exe %%f %%f.txt

A short explanation of what’s going on here.

%1 is your folder which you dropped into the batch file.

The FOR statement then takes all files in this folder with a PDF extension and passes each applicable file to GetText as the variable %%f sequentially.

Not bad for a single line of text. Sometimes, a knowledge of some common DOS commands can handle certain tasks faster than writing code :)

Check out Kryloff Technologies’ GetText utility, Rick Lively’s downloadable Command Reference or my premade batch files. Create shortcuts to these two batch files and you can use them in most situations to convert your text files by dragging and dropping files or folders over the batch files respectively.

MORE @ THE DOWNLOAD MUNKEY:
Read Books on Your Mobile Phone with TequilaCat BookReader
Text Mining Tools - Extracting text from CHMs
Wikibooks, WikiType & PDF Wikis

Tags:

Random Monday : Exporting and Converting Bookmarks with Bookmark Buddy

I’m been searching for an application to convert some of my Opera bookmarks to a Link/URL table format as a spreadsheet in Excel or CSV format for several months now and I think have finally found one fits the bill (otherwise I wouldn’t be writing this :) )

I basically wanted to transfer my current list of bookmarks to downloads and sites that I haven’t checked out in detail in Wikidpad which I store most of my personal Todo lists. More on Wikidpad in the future.

While I usually try not to recommend shareware here at The Download Munkey if freeware and open source alternatives exist, but at this time I’m hard-pressed to say if there are any other software (even commercial) that surpasses Bookmark Buddy’s capabilities and flexibility in converting and exporting bookmarks. I do know there are free software to convert bookmarks for transferring between broswers, but I definitely haven’t seen any that can export to CSV (yet).

Below’s a a quick 3 step guide on using Bookmark Buddy to export your bookmarks to a more processable format (is there such a thing as processable?)

Import your bookmark list.

Mark folders and bookmarks that you wish to export (not needed if you just want to export everything in the list.)

Select format to export to. Remember to check Include only marked bookmarks if you’re exporting a partial list and you’re done!

The example here uses Opera since that’s the only browser I use but the other major browsers like Internet Explorer, Mozilla Firefox are also supported by Bookmark Buddy, of course.

Export and conversion of bookmarks is only one of the many features available in Bookmark Buddy. To be honest, I’m not exactly familiar with Bookmark Buddy since I only used it for an hour or so to convert my Opera bookmarks to CSV but here’s a list of the more usable features I found while fiddling with it last weekend.

  • A central repository for storing, organizing and visiting internet bookmarks in your preferred browser. Should be very useful for people who regularly use different browsers and want to share the bookmarks between them without the hassle of trying to keep the bookmarks in every broswer in sync.
  • Delete duplicate bookmarks via Edit > Manage Duplicates
  • Scheduling of bookmarks to visit using Smart Folders.
  • Checking of updates to your bookmarks in the background so that you don’t waste time visiting sites that haven’t been updated or have been moved or disappeared.
  • Encryption of your list of bookmarks with a 128 bit Blowfish algorithm for the paranoid.

Download Bookmark Buddy or check out the features. The application is available for a 30 day trial and costs 29.95 USD to register.

MORE @ THE DOWNLOAD MUNKEY:
NirSoft.net - My First Stop for Quality Utilities
Foxit Reader vs PDF-XChange Viewer vs Sumatra
Combining PDFs with PDFTKBuilder
Lifehacker.com - Productivity and Software Guide

Tags:

Random Monday : Scratch - Interactive Media For The Masses

A project by the Lifelong Kindergarten Group of MIT Media Labs with financial support from the National Science Foundation, Intel Foundation and the MIT Media Lab, Scratch is a educational interactive content creation tool aimed primarily at kids to create their animations, stories and games in a very easy to learn scripting language. Just think of it as a very simplified Flash and you’ve got the general idea how Scratch works. Picked up this interesting authoring tool up from Games For Gamers site.

Animation and interaction is built into your project by dragging and dropping predefined scripts and linking them together. It’s extremely easy to construct a decent animation in several minutes since zero programming is required. Programming constructs like loops and conditions can be utilized for more advanced tasks. There isn’t a way to create scripts other than the ones you see in Scratch but if you require that level of functionality, you’re probably better off learning and using Flash :) That said, the scripts included are directly more than adequate for most tasks. Below are the diagrams for two of my test scripts

Any interactive media project requires images which you can create directly in Scratch directly or import from existing files. A library of images and sounds is installed with Scratch by default. Below is a very simple interactive game which I cooked up in half an hour where the hungry shark has to eat the starfish flying from side to side. Don’t ask why :)

There’s extensive documentation like getting started guides and reference manuals as well as a series of flash cards in PDF format to serve as tutorials in implementing basic tasks for users new to Scratch. There’s a lot of sample projects included too if you prefer to learn from examples.

The simple and colourful interface might turn off snobbish programmers but as long as it teaches and interests kids and non-programmers in learning about logical aspects of programming (and hopefully becoming future game developers), I can’t say that’s a bad thing at all :)

Download Scratch from MIT Media Labs.

MORE @ THE DOWNLOAD MUNKEY:
Fun Drawing Tools For The Masses
Virtual Lego Designers
Create Your Own Graffiti Masterpiece with Graffiti Studio 2.0

Tags:

Random Monday : NirSoft.net - My First Stop for Quality Utilities

Since I’ve been using several of Nir Sofer’s (NirSoft) applications quite regularly both at work and at home, I hope that some of his utilities I list below will prove as useful to you as they are for me.

I recommend NirSoft’s applications for several reasons:

  • Portable - copy and run directly from USB flashdrives as they do not require installation and do not write to the registry or your profile folder(s)
  • Small downloads - usually < 50 KB
  • Freeware - always a good thing :)

Below are 5 of his software that I use regularly. Most of these utilities have a built-in feature which allows HTML reports to be generated for the information displayed onscreen.

CurrPorts


© Nir Sofer

I mainly use this for my network coding at work to monitor the status of opened ports. Also useful to check and terminate for rogue ports connected to suspicious addresses.

RegScanner


© Nir Sofer

Anyone who has attempted to work with the Find feature in RegEdit on a regular basis will find this utility a god-send. Searches and displays all registry keys matching your search keyword with much more options than the Regedit Find function in a fraction of the time.


© Nir Sofer

SysExporter


© Nir Sofer

Dumps text from most listboxes, comboboxes and textboxes in any running application into HTML or CSV files. I usually use it to export the search results in Window Explorer.

AddrView


© Nir Sofer

AddrView parses either a HTML file on disk or online and extracts the links which you can either click to download immediately or export to a HTML format for later use. My primary use for it is to export links to HTML and then importing and cataloguing my downloads in spreadsheets.

FoldersReport


© Nir Sofer

Calculates the number of files and disk space used in the folder (and optionally subfolders) of your choice. Frankly speaking, there isn’t much occasion for using FoldersReport but I have some weird fascination with pointless statistics like these at times.

Other than the five applications showcased above, NirSoft also has an extensive selection of password recovery applications over the usual system, browser and network utilities.

Download NirSoft’s utilities. I recommend subscribing to the NirSoft RSS feed for information on new releases and updates to his existing applications.

MORE @ THE DOWNLOAD MUNKEY:
Using Sandboxie for testing New Software
Keep Track of Your HDD Space with TreeSize Free

Tags:

Military Tuesday : AKs, Screensavers & Image Rippers

Found this nice screensaver featuring 10 AK-type semi-automatic rifles and light machineguns from Arsenal, Inc. Some of my favourites below:


© Arsenal, Inc

Screensavers aren’t really useful for me since I don’t use them on my desktop and it seems a waste not to be able to use these photos in the screensaver as wallpapers. I fiddled with the screensaver a bit to see if I could somehow extract these photos from the screensaver as standalone images and below is a short summary of my findings. It’s slightly on the technical side, so do feel free to skip it and head for the download link at the bottom if you don’t want to bother with it :)

Running the screensaver installer under Sandboxie (an short intro here) reveals that four files are extracted into the windows\system32 folder in your sandbox.

Since photos are usually saved as JPG files, I resolved to search for the JPEG header or more specificially the Start of Image (SOI) marker (two bytes - 0xFFD8 - more about the JPEG header) in the SPF file with my trusty HxD hex editor. Each occurrence is followed by JFIF bytes which further confirms that the images are stored in this file as JPEGs and without any compression (ZIP, RAR, etc)

While I could write a parser which could spit out the JPEG images from the SPF images, I’m a bit too lazy for that at the moment and decided to use Marco Pontello’s excellent BitmapRip which extracts images in JPEG, PNG or GIF format from any binary file. Simply drag and drop the SPF file over BitmapRip and you’re all done!

Download the Arsenal Inc AK Screensaver and BitmapRip.

MORE @ THE DOWNLOAD MUNKEY:
Zacca 1/6 Guns Collection & World Weapon Collection
Oleg Volk’s High Resolution Firearms Photos
Modern AKs
H&K MP5 Vexel Art by John Norris

Tags:

Next Page »