Jump to content

[Help] Pass the result to Alfred by Script Filter

Recommended Posts

Hello, I’m developing bookmark workflow for the minor browser.

Now, I faced the problem.
I’m pass Alfred Json by script filter.
When I run my code by `python3`, I checked correct outputs like below:
  "items": [
      "arg": "https://www.alfredapp.com/help/workflows/inputs/script-filter/json/",
      "subtitle": "https://www.alfredapp.com/help/workflows/inputs/script-filter/json/",
      "title": "Script Filter JSON Format - Workflow Input Objects - Alfred Help and Support",
      "uid": "https://www.alfredapp.com/help/workflows/inputs/script-filter/json/",
      "valid": true


But I couldn’t show my result by Alfred. 
My code
class UrlItem:
    name: str
    url: str

class EnhancedJSONEncoder(json.JSONEncoder):
    def default(self, o):
        if dataclasses.is_dataclass(o):
            return dataclasses.asdict(o)
        return super().default(o)

# There is Parser class 
def main():
   json.dump(dict(items=mapToAlfredJson()), sys.stdout, indent=2, sort_keys=True, cls=EnhancedJSONEncoder)
   return 0

def mapToAlfredJson():
    alfredJsonList = []
    for item in bookMarkList:
    return alfredJsonList

if __name__ == "__main__":
    code = main()

Can I get your help? 😭

Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...