Jump to content

drgrib

Member
  • Posts

    19
  • Joined

  • Last visited

Posts posted by drgrib

  1. On 2/19/2021 at 3:49 AM, deanishe said:

    What exactly are you trying to achieve? Having a bunch of stuff in Alfred's clipboard history doesn't sound like it's your actual end goal.

     

    For me, having a bunch of stuff in Alfred's clipboard history is actually the end goal. I have a workflow I use to copy a Bear markdown formatted link, the raw link, and the title of the current active Chrome tab to the clipboard history. Depending on the task, I need any one of the three. The process is slowed down by the waiting between copies that the OP mentioned.

  2. I have a script filter that provides an initial menu with items that have "valid":false with UIDs that autocomplete to the query for a deeper menu with items that have "valid": true.

     

    I've noticed that these UIDs in the first menu are only used for sorting if I change them to "valid":true. But then they don't autocomplete anymore and the workflow exits before going to the second menu. So Alfred is causing a catch 22 for this workflow: either autocomplete for a second menu or get UID sorting based on past answers. Why can't we do both?

  3. For anyone else trying to get this working with your own Swift scripts and apps, adding this to the beginning should update your program to ask for permissions within Alfred:

     

    import EventKit
    import Foundation
    
    // get calendar store
    let store = EKEventStore()
    
    // ask for permissions
    store.requestAccess(to: .event) { (granted, error) in
        if let error = error {
           print(error)
           exit(0)
        }
        if !granted {
           exit(0)
        }
    }

     

  4. I'm using a Swift script I wrote myself, not icalBuddy. I would really prefer it be added here. Is there a simple workaround for now?

     

    Alfred is not prompting for calendar permissions when the Swift script is denied access in a bash call.

     

    On 6/7/2019 at 2:14 PM, luckman212 said:

    I'm on 4.0.2 now - Does a section need to be added to this dialog to specifically request Calendar access?

     

    image.png.5d001ed470bbf9445c902f4ab2035ad7.png

     

  5. 1 hour ago, vitor said:

    Alfred won’t update the knowledge if you just autocomplete the List Filter’s keyword, you have to activate one of the options too.

     

    I just tried selecting the first option in the "sitelinks" list 4 times and "sitelinks" still appears just as far down in the results for "si".

  6. I can usually retrain Alfred with 2 or 3 manual selections after typing the letters I want it to match. For some reason, this isn't working with a list filter I have called "sitelinks". I type "si", press down to scroll through the results and manually select it, and press enter. It doesn't change in priority. Anything I can do to get Alfred to latch on to it for "si"?

     

     image.thumb.png.ee0d147c4f4af56872e04065d4626729.png

  7. I've created a new Bear Alfred workflow here:
    https://github.com/drgrib/alfred-bear


    It is faster compared to the current Bear Alfred workflow because it is written in Go instead of Python and has optimized SQL queries. It also adds tag searching and autocompletion, link pasting, and clipboard content to note on creation. I do appreciate the author of the original Bear Alfred workflow because I started mine from his design.

  8. Easy Alfred Workflow Script Filters in Go

    https://github.com/drgrib/alfred

     

    This is a lean but comprehensive implementation of the Alfred Script Filter JSON Format to get Alfred workflows off the ground quickly with blazingly fast script filters in Go that can be seamlessly developed inside or outside Alfred.

     

    It uses standard, familiar Go syntax and conventions as much as possible for rapid use by Go developers and integration with other Go code.

     

    A Simple Example

    Let's say we want to create a simple script filter that converts a given query to title case, lower case, or upper case, for which Go conveniently has built-in support.

     

    Let's start by prototyping our logic in Go with a case.go file in our workflow folder. We can do this on the command line or in the editor of our choice and easily run it inside or outside of Alfred:

    package main
    
    import (
    	"strings"
    
    	"github.com/drgrib/alfred"
    )
    
    func addCases(arg string) {
    	titlecase := strings.Title(arg)
    	alfred.Add(alfred.Item{
    		Title:    titlecase,
    		Subtitle: "Title",
    		Arg:      titlecase,
    		UID:      "titlecase",
    	})
    
    	lowercase := strings.ToLower(arg)
    	alfred.Add(alfred.Item{
    		Title:    lowercase,
    		Subtitle: "Lower",
    		Arg:      lowercase,
    		UID:      "lowercase",
    	})
    
    	uppercase := strings.ToUpper(arg)
    	alfred.Add(alfred.Item{
    		Title:    uppercase,
    		Subtitle: "Upper",
    		Arg:      uppercase,
    		UID:      "uppercase",
    	})
    }
    
    func main() {
    	arg := "just a test"
    	addCases(arg)
    	alfred.Run()
    }
    {
        "items": [
            {
                "uid": "title",
                "title": "Just A Test",
                "subtitle": "Title",
                "arg": "Just A Test"
            },
            {
                "uid": "lower",
                "title": "just a test",
                "subtitle": "Lower",
                "arg": "just a test"
            },
            {
                "uid": "upper",
                "title": "JUST A TEST",
                "subtitle": "Upper",
                "arg": "JUST A TEST"
            }
        ]
    }
    

    Looks good. Now let's add os.Args support and test it on the command line to simulate Alfred input:

    package main
    
    import (
    	"os"
    	"strings"
    
    	"github.com/drgrib/alfred"
    )
    
    // [same stuff in the middle]
    
    func main() {
    	arg := os.Args[1]
    	addCases(arg)
    	alfred.Run()
    }
    go build case.go
    ./case "another test"
    {
        "items": [
            {
                "uid": "title",
                "title": "Another Test",
                "subtitle": "Title",
                "arg": "Another Test"
            },
            {
                "uid": "lower",
                "title": "another test",
                "subtitle": "Lower",
                "arg": "another test"
            },
            {
                "uid": "upper",
                "title": "ANOTHER TEST",
                "subtitle": "Upper",
                "arg": "ANOTHER TEST"
            }
        ]
    }
    Right again. Alright. Now let's drop this into our script filter:
    image.png.813ab4417e902a62477cdde4f9c73ad7.png
     
    And give it a whirl:
    image.png.728b6848423a1b278f89f0b3a217fef4.png
     

    Why not copy these to the clipboard so we can actually use them?

    image.png.d2eb2e22a372b7ceb27a233f6eb472a1.png
     
    With a few simple runs and a glance at the Alfred clipboard history, we can see we are ready for business:
    image.png.c7fb002e1765e66a6031e9bd4206e17b.png
     
    Easy!
×
×
  • Create New...