1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Quick Look with Quicksilver

Discussion in 'Mac Programming' started by turkeypants, Nov 27, 2007.

  1. macrumors newbie

    #1
    I am trying to make a Quicksilver action that will take a file and show the quick look preview of it. So far I have (1) created a bash script, (2) created an applescript that calls the bash script, and (3) placed the applescript in the Actions folder for Quicksilver.

    It works, but after the quick look pane is invoked Quicksilver remains the foremost application, in front of quick look. One can easily click on the quick look pane and bring it into focus, but is annoying. Any ideas on how to prevent this from happening?

    Bash
    Code:
    #!/bin/bash
    qlmanage -p "$@" >& /dev/null &
    Applescript
    Code:
    on open of theFile
    	set thePath to POSIX path of theFile
    	do shell script "~/bin/ql " & thePath
    end open
     
  2. macrumors 6502a

    lancestraz

    #2
    Sorry, but where is the QuickSilver actions folder?
     
  3. macrumors newbie

    #3
    Location of Actions Folder

    The Quicksilver Actions folder is: ~/Library/Application Support/Quicksilver/Actions

    If the folder doesn't exist, then create it. Once an action is added, restart Quicksilver for it to show up.

    Any ideas on this window focus problem though?
     
  4. macrumors 6502a

    lancestraz

    #4
    Ah, there it is. Anyway, this works for me...

    Code:
    on open of theFile
    	set thePath to POSIX path of theFile
    	do shell script "qlmanage -p \"$@\" >& /dev/null " & thePath
    end open
    If for some reason that doesn't work try...

    Code:
    on open of theFile
    	set thePath to POSIX path of theFile
    	do shell script "qlmanage -p \"$@\" >& /dev/null " & thePath
            tell application "Finder" to activate
    end open
     
  5. macrumors newbie

    #5
    Thanks! Both of those options do work a lot better, not perfect but useable for now.

    The first option: when you close the Quick Look pane, Quicksilver is active behind it.

    Second option: when you close the Quick Look pane, Finder because active (obviously), but if you have some other application up before it is deactivated. Any way to bring the activity back to the window that was in focus before Quicksilver was called?

    Thanks again.
     
  6. macrumors 6502a

    lancestraz

    #6
    How about...
    Code:
    on open of theFile
    	set thePath to POSIX path of theFile
    	do shell script "qlmanage -p \"$@\" >& /dev/null " & thePath
    	tell application "Quicksilver" to close window 1
    end open
     
  7. macrumors newbie

    #7
    Works great! Thanks for your help.

    For all those interested here is the script to download. Unzip. Place script in the ~/Library/Application Support/Quicksilver/Actions folder. Create the Actions folder if it doesn't already exist. Then, restart Quicksilver.

    To use, call Quicksilver, select a file, tab, type "QuickLook" and hit enter. The pane is closed by clicking on the X.
     

    Attached Files:

  8. Administrator emeritus

    xUKHCx

    #8
    Is there anyway so you an close it without having to click on the X, i.e. keyboard shortcuts.
     
  9. macrumors newbie

    #9
    Only works with certain things?

    After much effort, I got this to work, but it only seems to be capable of handling pictures. I've tried txt, rtf, doc, and pages files, and none of them work. I simply get a weird quicklook window with an off-center box that has a dotted line border.

    Any ideas? I could post screenshots if needed.
     
  10. macrumors newbie

    #10
    The first line should be changed to
    Code:
    set thePath to quoted form of POSIX path of theFile
    so that it works for files with spaces in the path.
     
  11. macrumors regular

    #11
    Hey,

    I installed the attached script above to Quicksilver 'Actions' file however (like a user above has stated), the Quicklook window cannot be closed using spacebar like normal.

    Any ideas as to a fix?
     
  12. macrumors 6502a

    lancestraz

    #12
    I have no idea how to make it do this.
     
  13. macrumors newbie

    #13
    Can I disable the left and right-arrow native shortcuts in iTunes (which are by default assigned to play the previous and next song), and then assign it to some scripts i've made (in this case, to fast forward/ rewind 10 seconds of currently playing song)?

    thanks!
     
  14. macrumors newbie

    #14
    Brilliant!

    This worked a treat - thanks!
     

Share This Page