Jump to content

Misha

Member
  • Posts

    21
  • Joined

  • Last visited

Posts posted by Misha

  1. I'm definitely doing funky things. And I'm also sure the things I do could be done differently and better. (I built my own time-clock (checking in and out for certain tasks). For that, this  setup works for me because 1. it shows all the options at once, while (I believe) a file filter wouldn't 2. I can adjust the icons (they are dynamic) and 3. I can attach arguments to these options that I use later on in the workflow.)

  2. Thanks Deanishe for your quick reply. The item point solved the problem! (I changed the directory to "mydirectory" because of privacy reasons). I am sure there are more elegant ways of doing this, but for anyone trying to do the same, this code works for me:

     

    cat << EOB
    
    {"items": [
    
    EOB
    
    for f in /mydirectory/*; 
    
    do
    
    x=$(basename "$f")
    x1="${x%.*}"
    x12=$(echo $x | sed 's/_.*//')
    
    cat << EOB
    
    
        {
            "uid": "$x1",
            "type": "file",
            "title": "$x1",
            "subtitle": "",
            "arg": "/mydirectory/$x1",
            "autocomplete": "$x1",
            "icon": {
                "path": "colour_$x12.png"
            }
        },
    
    
    EOB
    done
    
    cat << EOB
    ]}
    EOB
    

     

  3. Hi all, is it possible to create a dynamic script filter, in the sense that the list of options is created on the basis of the contents of a directory? I currently have this code, which seems to work in the terminal, but it doesn't produce the list that I would like:

     

    for f in mydirectory/*;
    
    do
    
    x=$(basename "$f")
    x1="${x%.*}"
    x12=$(echo $x | sed 's/_.*//')
    
    cat << EOB
    
    {"items": [
        {
            "uid": "$x1",
            "type": "file",
            "title": "$x1",
            "subtitle": "",
            "arg": "mydirectory/$x1",
            "autocomplete": "$x1",
            "icon": {
                "path": "colour_$x12.png"
            }
        },
    ]}
    EOB
    done
    

     

     

     

  4. Hi guys, I have a workflow in which I use the (selection in macOS) as the "query" in a bash script (it runs an OCR on the selected file). To do this, I use the "argument: Selection in macOS" of the "hotkey", but I would rather use a keyword (rather than a hotkey) to run the script (so that I can for instance more easily run the OCR_english and OCR_dutch versions of the script). Is this possible?

  5. Hi guys, I wrote a little AppleScript that copies and pastes a text selection to the Alfred bar with a certain prefix: see below.

     

    The thing is, when I select text, and run the .scpt file from the Alfred bar (i.e. I look up the file and press enter) it works fine, but when I try to link this  script to an Alfred keyword or hotkey, it stops working. I tried these three methods:

     

    • I simply copied the content of the .scpt file into an Alfred workflow (actions --> RunNSAppleScript). Doesn't work.
    • I wrote a bash script calling the .scpt file and attached it to the action  "run script". Doesn't work.
    • I used the action "open file" and attached the .scpt file to it. Doesn't work.

     

    It's not that these three methods don't do anything. In fact weird things happen. The text selection expands to adjacent words for example. Or I hear the "beep" of the mac "alert sound". I also sometimes seems as if the delay of 0.5 does not work.

     

    Its' not such a big deal. I can run the script by simply launching it by searching the file in the Alfred bar, but I'm still generally curious what is going on here. Any ideas?

     

    Quote

    tell application "System Events" to keystroke "c" using command down

    tell application "System Events" to keystroke space using command down

    delay 0.5

    tell application "System Events" to keystroke "n"

    tell application "System Events" to keystroke space

    tell application "System Events" to keystroke "v" using command down

     

  6. Thanks for the quick reply. No, stupid of me to not check that first. Spotlight also doesn't search inside .tex files either. I have found some posts about "spotlight importers" but so far I haven't found a solution yet. I know this is not the right place to ask these questions, but do you by any chance have a tip?

  7. Hi all, when I search for content inside files (which is under the prefix "in" by default), Alfred doesn't seem to read my .tex files. I have seen a couple of posts about difficulties with filtering .tex files, but I couldn't find any thread about this specific issue. Any tips? Thanks!

  8. Hi guys, is there any way to only search for contacts if you for instance type "c" first (or any prefix). Like "c john smith" would give me the contact viewer with john smith, while just "john smith" would simply launch the browser/search engine?

     

    (I don't want to enable "contacts" in default search results, because it would clog up the results, but I would also like the built-in contacts handlers).

  9. Hi all, I am not a regular on forums like this, so apologies for if I'm posting in the wrong place. Or asking a stupid question. I was just wondering if there is an easy way to search files within a folder. So within Alfred I navigate towards a certain folder, and then I want to search for files within only that folder. Preferably with the "in" command as well. I know there are search filters, but these have to be set up for specific folders beforehand. I would like to just search in any folder I happen to navigate to. Isn't there like an "action" that says "search in this folder" or something? Thanks!

×
×
  • Create New...