Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

turkeypants

macrumors newbie
Original poster
Nov 27, 2007
4
0
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
 

turkeypants

macrumors newbie
Original poster
Nov 27, 2007
4
0
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?
 

lancestraz

macrumors 6502a
Nov 27, 2005
898
0
RI
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
 

turkeypants

macrumors newbie
Original poster
Nov 27, 2007
4
0
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.
 

lancestraz

macrumors 6502a
Nov 27, 2005
898
0
RI
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
 

turkeypants

macrumors newbie
Original poster
Nov 27, 2007
4
0
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.
 

Attachments

  • QuickLook.scpt.zip
    6.6 KB · Views: 792

xUKHCx

Administrator emeritus
Jan 15, 2006
12,583
9
The Kop
Is there anyway so you an close it without having to click on the X, i.e. keyboard shortcuts.
 

ddcrandall

macrumors newbie
Apr 4, 2006
14
0
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.
 

antiraum

macrumors newbie
Dec 25, 2007
1
0
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.
 

.adam

macrumors regular
Nov 20, 2007
166
0
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?
 

lancestraz

macrumors 6502a
Nov 27, 2005
898
0
RI
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?
I have no idea how to make it do this.
 

ziriguidum

macrumors newbie
Jan 26, 2010
4
0
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!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.