Jump to content

c-c-c-c

Member
  • Posts

    13
  • Joined

  • Last visited

Posts posted by c-c-c-c

  1. 37 minutes ago, vitor said:

    On the other objects you can only get one at a time through {query}.

     

    Ah got it - this is what was tripping me up. Thanks for the explanation. I thought there might be a possibility of accessing the individual arguments within a workflow object (copy to clipboard, open url, et.)

     

    It might be helpful if the example in the help be amended with that caveat (or an explanation of the difference between args and vars):

     

    https://www.alfredapp.com/help/workflows/inputs/script-filter/json/

      Quote

    While optional, it's highly recommended that you populate arg as it's the string which is passed to your connected output actions. If excluded, you won't know which result item the user has selected.

    It is also possible to pass multiple arguments via an array of strings:

    "arg": ["~/Desktop", "~/Pictures"]

     

  2. Yes you're right, I'm conflating arguments/variables (I thought they were the same and couldn't find any documentation clarifying the difference).

     

    Attaching a screenshot of the workflow.

     

    Ultimately, what I'm curious about is how to use arguments downstream in my workflow: 

     

    Given I'm passing this (in a bash script filter):

    "arg": ["Services", "4A7B6A86-460D-4C90-8E20-82DD061E0016"]

     

    How do I access those arguments in a copy to clipboard or open url action:

     

    to generate a markdown link in copy to clipboard:

    [{Services <-- what is the syntax to echo the first argument }](x-devonthink-item://{4A7B6A86-460D-4C90-8E20-82DD061E001 <-- what is the syntax to echo the 2nd argument

     

    to generate a url in open url:

    x-devonthink-item://{4A7B6A86-460D-4C90-8E20-82DD061E0016 <-- what is the syntax to echo the 2nd argument}?reveal=1

     

    I've solved this by avoiding (multiple) arguments all together and using @deanishe's excellent guide Workflow/environment variables in Alfred — deanishe.net

    and outputted a variable instead in my script filter:

     

    (excerpt)

    {
    "title": "Design Services",
    "subtitle": "Business",
    "arg": ["Design Services"],
    "variables": {"uuid": "4A7B6A86-460D-4C90-8E20-82DD061E0016"},
    "match": "Design Services "
    },

     

    and accessing the variable (var:uuid) and first arg(query) downstream using:

     

    [{query}](x-devonthink-item://{var:uuid})

     

    but how would I do this using only arguments? 

     

    Screen Shot 2023-02-23 at 9.31.45 AM.png

  3. Hi,

     

    I've got the following (truncated  here to show 2 results) json in a script filter. I'm passing out two args:
     

    {
      "items": [ 
    	{ "title": "Business", 
         "subtitle": "Practice", 
         "arg": ["Business", "B5F64C25-6C8D-4771-A9D7-7A86F7D98B95"], 
         "match": "Business " }, 
        { "title": "Design Services", 
         "subtitle": "Business", 
         "arg": ["Services", "4A7B6A86-460D-4C90-8E20-82DD061E0016"], 
         "match": "Design Services " 
        } 
      ] 
    }

     

    I'm outputted multiple arguments based on this:

    Quote

    While optional, it's highly recommended that you populate arg as it's the string which is passed to your connected output actions. If excluded, you won't know which result item the user has selected.

    It is also possible to pass multiple arguments via an array of strings:

    "arg": ["~/Desktop", "~/Pictures"]

    https://www.alfredapp.com/help/workflows/inputs/script-filter/json/

     

    How do I parse the arg into two variables I can access later in my script? I've tried a split arg with newline as delimiter, which isn't working.

     

    Can I access them directly (without split arg)? `{var:1}` or `{var:var2}` doesn't seem to work either.

     

  4. Hi There,

     

    Is there a way to get expose the value of `kMDItemDisplayName` in a workflow?

     

    I have a file filter from which I'm trying to extract the value of `kMDItemDisplayName` so I can output a markdown link on the pasteboard.

     

    It's exposed in the title field of the results, but there doesn't seem to be a programmatic way to access it? I looked through the Automation Tasks and couldn't find anything. Also looked through the documentation under dynamic placeholders (would be great if file metadata could be exposed this way). I can't use `{query} ` as it returns a path and the filename is a uuid.

     

    Thanks

     

    image.png.20fbfbffbb3a24718e97271a31b3350a.png

     

     

     

×
×
  • Create New...