Any way to activate QuickLook from Launchbar?

General discussions about LaunchBar
randyharris
Rank 1
Rank 1
Posts: 34
Joined: Thu May 10, 2007 9:10 am

Any way to activate QuickLook from Launchbar?

Post by randyharris » Wed Oct 31, 2007 10:42 pm

When I use LaunchBar to locate a file on my Mac, is there a way that I can fire it up in QuickLook, instead of hitting enter to open it in it's default application?

Thanks

jsnell

Re: Any way to activate QuickLook from Launchbar?

Post by jsnell » Thu Nov 01, 2007 1:18 am

randyharris wrote:When I use LaunchBar to locate a file on my Mac, is there a way that I can fire it up in QuickLook, instead of hitting enter to open it in it's default application?


+1! I was just about to file this as a feature request. Activating QL from within LB would be excellent!!

Guest

Post by Guest » Thu Nov 01, 2007 5:12 am

I'm thinking maybe setting it up so that the Space bar activates Quick Look (as in Finder) and then some other key to open the 'entry mode'

Randy

Guest

Post by Guest » Fri Dec 07, 2007 6:05 pm

+1

Oliver

SteveH
Rank 1
Rank 1
Posts: 33
Joined: Tue Jul 31, 2007 3:48 pm

Post by SteveH » Sun Dec 09, 2007 10:15 pm

I just found myself trying to open a quick look from within LB and it would be very intuitive to just be able to hit the space bat as in the Finder and also in the (third-party) Path Finder.

veke
Rank 2
Rank 2
Posts: 49
Joined: Mon Nov 06, 2006 11:30 am

Post by veke » Mon Dec 10, 2007 12:50 am

yes please

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Mon Dec 10, 2007 3:48 pm

I also would like to have a built-in solution, but for the time being you can use
this script.
(EDIT: Use Dennis' Script instead, it's MUCH better and can be found further down. I'll leave this download as it contains a nice icon :-) )

I only slightly modified it from the version you can find here:
http://forums.macrumors.com/showthread.php?t=393693

The original script, logo is all from turkeypants. (I only removed one line :wink: )

Select your file and instant send it to the script.

Right now there are some known flaws, for example I don't know how to close the window without having to click the close button. (kinda defeats the quickness about it, but well… :? )

Tell me how you like it!
Sincerely,
Ludwig
Last edited by ludwigschubert on Mon Dec 10, 2007 7:45 pm, edited 1 time in total.

norbert
Objective Development
Objective Development
Posts: 648
Joined: Thu Nov 09, 2006 6:30 pm

Post by norbert » Mon Dec 10, 2007 7:08 pm

Unfortunately, Apple currently restricts the use of Quick Look to Apple-developed programs only:

http://developer.apple.com/docu.../QLUserExperience/chapter_2_section_4.html

"Clients of quick look request thumbnails and previews for listed and selected documents, respectively, and receive images for display. These clients are currently restricted to certain Apple-developed system applications, particularly Finder, Spotlight, Time Machine, and FileSync."

The above-mentioned script (which utilizes the qlmanage command-line tool) seems to be the only workaround to this limitation, but as Ludwig pointed out, it doesn't allow to close the Quick Look viewer using the keyboard, which makes this approach rather pointless, IMO.

It seems we have to wait until Apple officially allows us to use Quick Look from within third party applications.

Dennis

Post by Dennis » Mon Dec 10, 2007 7:21 pm

ludwigschubert wrote:Right now there are some known flaws, for example I don't know how to close the window without having to click the close button. (kinda defeats the quickness about it, but well… :? )


Hitting the Escape key (esc) will close the Quick Look window.

I was just about to post my own version of the script, but you beat me to it. :) I like it.

-Dennis

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Mon Dec 10, 2007 7:33 pm

@Dennis:

Actually it doesn't for me.

I would love to know how it works for you, though :-)

Also, I should emphasize it's not my script, but turkeypants' from macrumors.com. Glad you like it, though.

@norbert:
I always think it's very sad to see such things happen.
Always makes me wonder where's the point in Apple preventing devs from using their private APIs? QL seems to be working fine, doesn't it? :sigh:

yours,
Ludwig

Dennis

Post by Dennis » Mon Dec 10, 2007 7:39 pm

Dennis wrote:Hitting the Escape key (esc) will close the Quick Look window.


Correction: hitting the Escape key only seems to close the Quick Look window if you don't redirect STDOUT to /dev/null, which I wasn't doing in my version of the script. I also added support for multiple files.

For example, you can select multiple files in the Finder, use Instant Send to put them on the bar, then send to the Quick Look script. Of course, you could just hit spacebar in the Finder to see Quick Look immediately, but hey, this is the LaunchBar forum. :)

Here is my script:

Code: Select all

on open listOfFiles
   set filePaths to ""
   repeat with oneFile in listOfFiles
      set thePath to quoted form of POSIX path of oneFile
      if filePaths is not equal to "" then set filePaths to filePaths & " "
      set filePaths to filePaths & thePath
   end repeat
   do shell script "qlmanage -p " & filePaths
   --do shell script "qlmanage -p "$@" >& /dev/null " & filePaths
end open


I left Ludwig's original call to qlmanage and redirection to /dev/null in the script just in case someone wanted to use it.

-Dennis

Dennis

Post by Dennis » Mon Dec 10, 2007 7:45 pm

ludwigschubert wrote:Also, I should emphasize it's not my script, but turkeypants' from macrumors.com. Glad you like it, though.


Yeah, I should give credit to this post by fortepianissimo on MacOSXHints, where I originally saw it:

http://www.macosxhints.com/article.php?story=20071128071402814

-Dennis

norbert
Objective Development
Objective Development
Posts: 648
Joined: Thu Nov 09, 2006 6:30 pm

Post by norbert » Mon Dec 10, 2007 8:25 pm

Dennis wrote:I left Ludwig's original call to qlmanage and redirection to /dev/null in the script just in case someone wanted to use it.

The redirection has no effect anyway. Have a look a the Console - every time the script gets invoked, it logs about fifty messages to the Console (depending on the number of Quick Look generators available on your machine).

And according to the log messages it seems that with each invocation of the qlmanage command the entire Quick Look engine has to be initialized from scratch again and again (loading and registering dozens of Quick Look generators), which makes this approach rather slow compared to Finder's implementation.

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Mon Dec 10, 2007 8:42 pm

norbert wrote:And according to the log messages it seems that with each invocation of the qlmanage command the entire Quick Look engine has to be initialized from scratch again and again (loading and registering dozens of Quick Look generators), which makes this approach rather slow compared to Finder's implementation.


I thought it felt slower. Oh well, at least it's something to play with. :)

le_xav

QuickLook integration

Post by le_xav » Tue Dec 11, 2007 3:51 pm

Hi
You should check this out:

http://ciaranwal.sh/2007/12/07/quick-look-apis

An example app is provided, which integrates the space-bar functionnality and also the eye-candiness.

It would probably be a good start for bringing QL to LB.
One of you, developers around, could also make an app that displays in QL the files passed as arguments...
Before a native implementation of QL is built into LB, such an app would allow instant-drop of files for QL viewing.
Moreover, it would be "cross-launcher" (QS,Launchbar,...)

What do you think?

Post Reply