Closed yinan-c closed 6 months ago
It’s technically possible. But you will have to do it yourself as the app is still focusing on links.
In the Python script of Search for links in Anybox
action from Alfred, you can add a type
parameter with value all
. So the payload will be like:
payload = {
'q': q,
'limit': 30,
'type': 'all' # 'link' (default) | 'note' | 'image' | 'file' | 'all'
}
With this change, you can search all types of content. If you need to show the file in Finder, you can continue to tweak the action with a few steps.
conditional
object in workflow editor.Add a new condition
button.matches regex
and paste the regex ^\/Users.*?
in the value field.Reveal File in Finder
action.If you don’t want to maintain a separate version of this workflow, you can copy the action and create a new workflow to just search for files.
Thank you very much! Following your guid, I got it working.
However the debug session shows following error message, do you know what might be the cause ? Is it relevant?
[02:26:13.989] ERROR: Anybox[Run Script] Traceback (most recent call last):
File "/Users//Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/
, line 10, in
This happens when I command + enter to reveal in Anybox, although successfully navigate to the file in anybox, there is an error message. (I guess it is not a big deal as long as it works.)
It’s not affecting any functionality. But if you want to remove the error, you can add a condition to make sure sys.argv
has enough arguments.
import urllib.request
import sys
import os
api_key = os.getenv('api_key')
headers = {'x-api-key': api_key}
if len(sys.argv) >= 3:
req = urllib.request.Request(
'http://127.0.0.1:6391/document/' + sys.argv[2], headers=headers, method='PUT')
urllib.request.urlopen(req)
Thanks, it is really helpful!
Hi, it seems the workflow only search for links, is it possible to search for files as well?