kostyafarber Posted October 14, 2022 Share Posted October 14, 2022 Hi all, I'm trying to configure a file filter that has a dynamic search scope. I'm aware we can use the JSON Utility and set the scope as a file path in a list, in the configs key. I wanted to set the scope based on a user configured variable (which is a file path that the user drags into the config). I was trying to set it up but it wasn't working. The problem is: When I set the scope manually I checked the file path and each file path (backslash) delimiter / is escaped with a (forward slash) \. When I access the variable (e.g {var:file_path}) it is not escaped. Is there an easy way to make sure that when I pass in this variable to JSON Config it's properly escaped? Or do I have to write some script filter that escapes it manually and pass that JSON to the file filter? Any suggestions will be much appreciated. Thanks! Link to comment
vitor Posted October 14, 2022 Share Posted October 14, 2022 Hard to say in the abstract. Please share the exact JSON config and/or a workflow so we can properly see how you’re doing it. Link to comment
kostyafarber Posted October 14, 2022 Author Share Posted October 14, 2022 For example when I add the path ~/Dropbox/notes, in the JSON Config is looks like "~\/Dropbox\/notes. Problem is in my Python script the file paths appear as usual without the escaping forward slashes. Is there some way to transform the file path within Alfred or if not is there any documentation to how file paths should be formatted to be passed as arguments to consequent workflow objects so I can format them accordingly. Thanks Link to comment
kostyafarber Posted October 15, 2022 Author Share Posted October 15, 2022 (edited) Also for example @vitor, In my Python script (using Script Filter) I am passing this path to the File Open object: /Users/kostyafarber/Dropbox/notes/Adding Captions to a Figure.md' But it's not being opened. This is the debug but nothing happens on my end. I know on Mac that spaces are escaped with forward slashes, maybe that's causing an issue? If I do the exact same thing but with a File Filter Object and pass that to a File Open object I see the exact same thing in the debug but it works (my file is opened in the default application). Why isn't it working when I pass the exact same path from a Script Filter? Unsure what's going on here. Thanks. Edited October 15, 2022 by kostyafarber Tag someone Link to comment
vitor Posted October 15, 2022 Share Posted October 15, 2022 3 hours ago, kostyafarber said: I know on Mac that spaces are escaped with forward slashes, That’s the shell, not macOS. And it does not apply to quoted strings. Again, I can’t help without looking at the real thing. Link to comment
kostyafarber Posted October 15, 2022 Author Share Posted October 15, 2022 (edited) Okay no worries. Here's the rough workflow. I've added notes. Just drop any folder into the user configuration with markdown files in it. Thanks https://www.dropbox.com/s/zvgt4ljjemv9pfo/Notable Search.alfredworkflow?dl=0 Edited October 15, 2022 by kostyafarber More info. Link to comment
kostyafarber Posted October 15, 2022 Author Share Posted October 15, 2022 Doh. Got it working. There was a static file dropped into the Open File Object... Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now