jprice Posted February 25, 2019 Posted February 25, 2019 Hi! I want to create a workflow where I want to drill into a JSON Object returned from a script filter. The object could look something like this: // items being the result returned from the script filter { items: [ { title: "Item 1", items: [ { title: "Subitem 1.1" url: "/some/url" }, { title: "Subitem 1.2" url: "/another/url" } ] }, { title: "Item 2", items: [ { title: "Subitem 2.1" url: "/some/url" }, { title: "Subitem 2.2" url: "/another/url" } ] } } What I want to achieve is that after starting the workflow, the script filter fetches the initial list of items and that I then can action one of these items and "drill down" into the object structure. So for this example, after invoking the workflow Alfred would show two results ("Item 1" and "Item 2") and after actioning the first item, it would show "Subitem 1.1" and "Subitem 1.2" which I could then action to open their URL in the browser. Honestly, I'm quite lost ¯\_(ツ)_/¯ Any help would be greatly appreciated!
deanishe Posted February 25, 2019 Posted February 25, 2019 (edited) You can't do it that way, I'm afraid. Alfred only supports a flat list of items, not a tree. You can recursively call the same Script Filter via External Triggers, but it's up to you to manage the position in the tree and return the appropriate list of items for that level. Here's a workflow I wrote that can drill-down into your Safari bookmark folders. But it works by first flattening the tree into a list and using folderID to select a sub-tree. If you want to keep your data as a tree structure, you might try passing a "dotted path", e.g. 1, 1.1, 1.2, back to your Script Filter and then extracting the relevant section. Edited February 25, 2019 by deanishe jprice 1
jprice Posted February 27, 2019 Author Posted February 27, 2019 Thank you! I've now essentially done the same thing (flattening the list). For my use case, this is sufficient. But I still think it would be a cool feature
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