|
|
10.6: Another way to view any text file in Quick Look
I got so tired of QuickLook showing my an icon instead of the text of a plain text file that doesn't end in .txt, that I wrote this AppleScript:
Save it as a drop script and put it in the Finder toolbar. You can then drag a plaintext file onto it to open a QuickLook window that will show you the contents. The only down side is that you have to close it by hand.
Also, this should work just by selecting the file and clicking on the script in the toolbar, but I get an error. Any AppleScript gurus out there know what I am doing wrong?
10.6: Another way to view any text file in Quick Look
A couple things:
1) inside the Run handler: use "as alias list" to have the Finder return references to the currently selected items as a list of references in alias format
2) in the Open handler: you don't need to coerce the input to an alias list, they already are by default
3) in the sub-routine: you have to create a space-delimited string of posix references by iterating the list of alias references, like this:
on showthefiles(theitems)
repeat with i from 1 to the count of theitems
set this_path to the quoted form of the POSIX path of (item i of theitems)
if i is 1 then
set the POSIX_list to this_path
else
set the POSIX_list to the POSIX_list & space & this_path
end if
end repeat
set thescript to ("qlmanage -p -c public.plain-text " & POSIX_list)
do shell script thescript
end showthefiles
10.6: Another way to view any text file in Quick Look
FYI, a QuickLook Droplet is already available and posted on MACOSXAUTOMATION.COM.
http://macosxautomation.com/applescript/quickviewer/index.html
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:Hints1 new Hints in the last 24 hoursComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.07 seconds |
|