Welcome to WebProNews Breaking eBusiness and Search News
Advertise | Newsletter | Sitemap | News Feeds News Feed 
 WebProNews Search Part of the iEntry network iEntry inc. 

Improve QuickLook In Leopard

A.P. Lawrence
Expert Author
Published: 2007-12-11

WebProNews RSS Feed


Leopard's new "Quicklook" is a nice tool, but for stubborn old command line types like me, it has some limitations: it won't show me plain text files unless they have the extension ".txt".

It's possible that somewhere there's a preference you could add to Quicklook, but I haven't heard of it yet.

There is another way to make Quicklook show "unknown" files: you can mess with the files Info.plist as explained at this MacOSXhints.com 10.5: Add Quick Look support for certain file formats post. But that's really only useful once you realize you WANT to look at the file; I wanted something more automatic.

A simple command line script does the job for me. I call it "looky":

#!/bin/bash
qlmanage -p -c public.plain-text "$@" 2> /dev/null &


(I modified that from a MacOSXhints.com post.)

Not much to it, is there? All it does is force Quicklook to interpret the file as plain text. We could make it fancier if we wanted by checking to see if we need to add the "-c public.plain-text", but for my command line use, this is fine - I don't need anything smarter.

But perhaps you do, so here's the "smart" version:

#!/bin/bash
# "smart" Quicklook script by http://aplawrence,com
if [ "$1" = "-f" ]
then
   shift
   qlmanage -p -c public.plain-text "$@" 2> /dev/null &
   exit 0
fi
for file in "$@"
do
   if [ "${file##*.}" = "$file" ]
   then
     qlmanage -p -c public.plain-text "$file" 2> /dev/null &
   else
     qlmanage -p "$file" 2> /dev/null &
   fi
done


That let's us add a "-f" if we absolutely want to force the issue. but otherwise uses "ordinary" Quicklook for files with extensions, and forces them to be interpreted as text if there is no extension.

Put this in ~/bin, chmod 755 it, and at a Terminal prompt, use "looky filenames or wildcards" to see it in action.

By the way, on my own system I would not have bothered with all the extraneous quotes around "$file" - the only reason those are there is because of files with spaces in their names, and I would create such a thing on my machine.

Comments

*Originally published at APLawrence.com

View All Articles by A.P. Lawrence



Receive Our Daily Email of Breaking eBusiness News


About the Author:
A.P. Lawrence provides SCO Unix and Linux consulting services http://www.pcunix.com

WebProNews RSS Feed

More Expert Articles Articles

Contact WebProNews
Advertisement





TOP NEWS

WebProBlog
The official blog of WebProNews.

Go to WebProBlog

Targeted Information for Business
WebProNews is part of the iEntry network

Internet Business: Marketing: Small Business:
WebProNews MarketingNewz SmallBusinessNewz
WebProWorld AdvertisingDay PromoteNews
EcommNewz SalesNewz EntrepreneurNewz

Software: Search Engines: Web Design:
WebMasterFree Jayde B2B DesignNewz
NetworkingFiles SearchZA FlashNewz
SecurityConfig SearchNewz WebSiteNotes

Developer: IT Management: Security:
DevWebPro ITManagement SecurityProNews
DevNewz SysAdminNews SecurityConfig
TheDevWeb NetworkingFiles NetworkNewz

The iEntry Network consists of over 100 web publications reaching millions of Internet Professionals. Contact us to advertise.
eBUSINESS RESOURCES






 Advertise | Contact Us | Corporate | Newsletter | Sitemap | Submit an Article | News Feeds
 WebProNews is an iEntry, Inc. ® publication - $line) { echo $line ; } ?> All Rights Reserved
WebProWorld
Ten most recent posts.


SearchBrains.com
NetworkingFiles
Featured Software


About WebProNews
WebProNews is the number one source for eBusiness News. Over 5 million eBusiness professionals read WebProNews and other iEntry business and tech publications.

WebProNews provides real-time coverage of internet business.

Free Email Newsletters:
WebProNews SearchNewz
WebProWorld DevWebPro
Marketing SecurityNews
Plus over 100 other newsletters!

Send me relevant info on products and services.


iEntry.com WebProWorld RSS Feed WebProWorld Contact WebProNews Print Version Email a friend Bookmark us SearchBrains.com SearchBrains RSS Feed