Not a system-wide shortcut, but I use Launchbar and adapted @bmorgan’s script to take text from Launchbar and plop it right into Quick Open. It’s not super-fast (a half second), and you miss out on find-as-you-type, but it works if you know where you want to go.
on handle_string(msg)
tell application "System Events"
tell process "OmniFocus"
click menu item "Quick Open…" of menu "File" of menu bar item "File" of menu bar 1
end tell
keystroke msg
end tell
end handle_string
Save it to ~/Library/Application Support/Launchbar/Actions/.
This is a great script. I’m not a scripting guru but have this working effectively through Keyboard Maestro. Is there any way after searching to bring Omnifocus to the front as the focused application automatically? This would make the script perfect.
UPDATE: Figured out how to do it, at least at the same time the Quick Open panel opens:
Wow this is awesome - I did this with Alfred2 in seconds. I added a global shortcut key and used the following script:
on alfred_script(q)
tell application "System Events"
tell process "OmniFocus"
click menu item "Quick Open…" of menu "File" of menu bar item "File" of menu bar 1
end tell
end tell
end alfred_script
@gtdwannabe I exported the workflow I created that binds “Option-Command-O” as a global hotkey. You can change this as you need. Also, you may need the powerpack. I’m using Alfred 2.3.
Thanks for this script! I’ve hacked together a slight change to get it to switch to OmniFocus, too. I’m no AppleScript whizz, but it works for me:
on alfred_script(q)
tell application "System Events"
tell process "OmniFocus"
click menu item "Quick Open…" of menu "File" of menu bar item "File" of menu bar 1
end tell
end tell
tell application "OmniFocus" to activate the default document
end alfred_script
(The last line of the alfred script is the new bit.)
This is all terrific stuff and works well for calling OF from alfred from any application. Still not solving the open omnifocus when closed. I think with minimal work, we could get there.
Since I posted, I discovered Shawn Blanc’s Oopsie Focus (which I highly recommend). If we adapt shawn blanc’s scipt, I think this will wind up being quite a nice piece of team scripting here. I tried to figure it out myself, but lack the skills.
If you want to input text into the quick open text field, here’s the code. Would you guys mind if I packaged this into an Alfred Forum’s post?
on alfred_script(q)
tell application "System Events"
tell process "OmniFocus"
click menu item "Quick Open…" of menu "File" of menu bar item "File" of menu bar 1
set value of text field 1 of front window to q
end tell
end tell
tell application "OmniFocus" to activate the default document
end alfred_script
I’m thankful for the script development here. I took the lazy approach and installed Fastcripts which lets you assign global hotkeys to scripts (10 total in the free version). That way I have the hotkey set to the same quick capture combo I use when OF is open.
And the “One Click Search All” thread you linked was golden. Got those working as well and love searching in two steps from the keyboard.
@gtdwannabe I’m not an Alfred user, but I just adapted Shawn Blanc’s OopsieFocus script to instead activate OF’s Quick Open panel if the app is closed.
You can set a global shortcut with Fastscripts per my post above, but the key difference between OopsieFocus and this script is that you do not want to make the script’s shortcut the same as OF’s Quick Open shortcut because of a conflict: system-wide, the CMD-O shortcut opens a file in its native app.
Therefore, either use the default shortcut when OF is open, and another one for this script; or, edit the script to remove the check on whether OF is running, and just force Quick Open with a new shortcut.
-- This script allows the opening of OmniFocus and a Quick Open panel using the Quick Open keyboard shortcut in OF in the event OF is not open.
-- If OF is open, nothing happens.
-- Launch using a launcher app with a global keyboard shortcut.
-- This is based on the OopsieFocus script written by Shawn Blanc
on appIsRunning(Omnifocus)
tell application "System Events"
return (count of (application processes whose name is Omnifocus)) is not 0
end tell
end appIsRunning
if appIsRunning("OmniFocus") then
null
else
tell application "System Events"
activate application "OmniFocus"
tell process "OmniFocus"
click menu item "Quick Open…" of menu "File" of menu bar item "File" of menu bar 1
set value of text field 1 of front window to ""
end tell
end tell
tell application "OmniFocus" to activate the default document
end if
@derekr’s script didn’t quite work for me, but this slightly modified one does:
on handle_string(msg)
tell application "System Events"
tell process "OmniFocus"
click menu item "Quick Open…" of menu "File" of menu bar item "File" of menu bar 1
set value of text field 1 of front window to msg
end tell
end tell
end handle_string