Workflow: Search in App
Alfred workflow to pass a query to an application’s own search by simulating ⌘F.
For applications that aren’t scriptable via AppleScript or URL scheme, you can simulate keypresses to open an app’s own search function and enter a query. This workflow is a relatively flexible implementation of that.
By default, the workflow puts your query on macOS’s Find Pasteboard, activates the target application, waits for it to be visible, and then simulates ⌘F.
If the application doesn’t support the Find Pasteboard, set
0 (see below) and the workflow attempts to type the query into the search field instead.
Finally, it simulates ↩ (by default) to start the search.
Configure the workflow via its configuration sheet in Alfred Preferences:
app_name is the name of the application you want to search in.
delay is how long (in seconds) the workflow waits for the app’s search dialog to activate after sending ⌘F before it attemps to type the query or send ↩.
press_return is set to
1, the workflow simulates ↩ to start the search.
timeout is how long (in seconds) the workflow waits for the application to become visible.
1, the workflow puts the search query on macOS’s Find pasteboard. Otherwise, the workflow attempts to type the search query in the application’s search field.
wait_visible is set to
1, the workflow waits until the application is visible before simulating any keypresses.
macOS has multiple pasteboards (clipboards), and one of these is called the Find Pasteboard (or Search Pasteboard). In applications that use macOS’s native search, the Find Pasteboard is automatically used for the search query (including live updates). You can put the currently selected text on the Find Pasteboard with ⌘E.
In Alfred 4+, the Hotkey trigger can also pass the contents of the Find Pasteboard to your workflow.