Jump to content

Search the Community

Showing results for tags 'script filter'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • Share your Workflows
    • Workflow Help & Questions
    • Advanced Tips & Tricks
  • Alfred Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting
  • Alfred 5 Early Access
    • Alfred 5 Early Access


  • Articles
    • Forum Integration
    • Frontpage
  • Pages
  • Miscellaneous
    • Databases
    • Templates
    • Media

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start




Website URL




  1. I Sheet You Not Create auto-updating workflows from Excel worksheets. Works like a List Filter but using an Excel file as the data source. I Sheet You Not is a workflow generator/template for Alfred 3. It reads data from an Excel workbook and displays them in Alfred. You can specify which rows and columns the data are read from, and changes to the data are picked up automatically by the workflow. Download and installation Download the workflow from Packal or GitHub releases and double-click the downloaded I-Sheet-You-Not-X.X.X.alfredworkflow file to install in Alfred. Usage Use keyword isyn to create a new copy of the workflow. You can either create an empty copy or search for an Excel file to base the workflow on. See the documentation for detailed usage/configuration instructions. Source code The source is hosted on GitHub. Bugs and feature requests Bugs and feature requests should ideally be submitted via GitHub issues, but asking in this thread is cool, too.
  2. Hello, I don't know if it's possible to emulate this behavior with a workflow trick (other than duplicate the script filter), but I think it would be useful to allow to have multiple keywords for a single script filter. It could be used to set multiple language keywords (like "weather" and "météo" in french), or just add a shortcut (like "w" or "wiki" for a wikipedia autocomplete workflow)
  3. Hi! Im using Simplenote and found out there is a CLI available. Now I want to create a workflow to search through my notes. I´m just starting to use the Script Filter more and still I don´t know how I can use json output from the cli to display the results in alfred. If I type something with the Script Filter: /usr/local/bin/sncli -n export {query} debugging shows me: ERROR: Simplenote Search[Script Filter] Unable to decode JSON results, top level type is not dictionary in JSON: [ { "tags": [], "deleted": false, "shareURL": "", "publishURL": "", "content": "gmail", "systemTags": [ "markdown" ], "modificationDate": 1599312951.145001, "creationDate": 1569875316, "key": "XXX", "version": 58, "syncdate": 1600667523.891809, "localkey": "XXX", "savedate": 1602487240.5917828 }, { "tags": [], "deleted": 0, "shareURL": "", "publishURL": "", "content": "gmail 2", "systemTags": [ "markdown" ], "modificationDate": 1587040951.0199919, "creationDate": 1587031436.520257, "key": "XXX", "version": 23, "syncdate": 1587154334.194783, "localkey": "XXX", "savedate": 1602487240.5917828 } ] How is it possible to create an item for each search result, for example with title: content, subtitle: creationDate, argument: localkey?
  4. There are probably quite a few sound device selector script filters out there, but the ones I've come across are mostly written in applescript. I rewrote my own in c++ and it runs much faster, so I'm sharing it here in case anyone's interested. Dependencies switchaudio-osx Command line utility for switching audio sources on macOS Link: https://github.com/deweller/switchaudio-osx Install: `brew install switchaudio-osx` [optional] terminal-notifier Command line tool for sending macOS user notifications Link: https://github.com/julienXX/terminal-notifier Install: `brew install terminal-notifier` Optionally configure workflow environmental variables: Set `NOTIFIER` to 'terminal-notifier' This replaces the alfred notification banner with one that looks like it's from System Preferences If setting `NOTIFIER` to 'terminal-notifier' doesn't work, try setting it to the path of `terminal-notifier` Use the terminal command `which terminal-notifier` to find the path Set `CMDPATH` to the path of `switchaudio-osx` Try this if the workflow doesn't work out of the box Use the terminal command `which switchaudiosource` to find the path Optionally blocklist specific devices: Type `sound:blocklist <full name of device>` into Alfred For example, `sound:blocklist zoomaudiodevice` Alternatively, press shift+return while a device is selected to hide it from future results Changelog v1.1.1 Fixed: Cannot parse switchaudio-osx JSON in some cases v1.1.0 Added: User-configurable device blocklist (see feature request) Fixed: Issue with user-set path for switchaudio-osx v1.0.2 Minor performance optimisations v1.0.1 Added: In most cases, users no longer need to specify the path of switchaudio-osx (see relevant comment) Fixed: Missing icon images in terminal-notifier notification Download | Source I'm very much a beginner at c++, so any criticism / guidance would be much appreciated. Screenshot
  5. Here's another little tool I've just whipped up: Get an instant list of the current time in various cities around the world. Which you can customize, of course. Main keyword: tz (for TimeZones) - this just shows the World Clock list (seen above). (Select a city for a Large Type display.) To remove a city from the list - option-select it. To add a new city - timezone add Name of City To update all cities' timezone offset information - timezone update To look up the time in a place without storing it (custom loookup), just keep typing the place name after the initial tz (eg. tz timbuktu) To move the location of your stored city list - timezone move Download v1.7a This workflow saves a list of your cities and their UTC offsets locally, so the basic world clock will display instantly. Adding new city information is done via an API call to Google Wolfram Alpha. The only downside to locally cached offsets is that there's no provision for automatically updating for Daylight Savings changes, but a manual timezone update will refresh all the cities with their current offset. Enjoy. As usual, I welcome comments, bug reports, feature requests, etc. ---- 28 March 2013 - UPDATE to v1.5 Major rewrite - now uses Google Maps APIs, which should be a lot more reliable and consistent. Flag icons! Bit of eye candy, courtesy of http://www.free-country-flags.com (and managed to squeeze flags for every country in the world into just over 400k - thank you TinyPNG ) More detail retrieved and displayed, including timezone name, country, etc. When doing a full "update", a text file is saved to your Desktop summarising any changes found. General enhancement and tweaks. PLEASE NOTE: Because this version stores its data substantially different to previous versions, it will create a new timezones.txt file with default cities. However, it will attempt to save your old timezones.txt file to your Desktop, so you should be able to rebuild your previous list without too much hassle. A quick note about the flags: The workflow simply compares the retrieved name of the country and does a simple name match against the workflow's local repository of flag icons. From my testing, it's working very well, but I'd appreciate it if you'd report back if you find any countries that don't properly match a flag icon. Cheers. ---- 31 March 2013 - UPDATE to v1.6 New feature: Custom lookups. Just keep typing a new place name after the tz keyword to look up the time in a place without saving it to your saved list. Added support for phyllisstein's Alleyoop auto-updater. [EXPERIMENTAL] - support for autocomplete for adding place names (timezone add). You'll need to add a keyword yourself to the script filter if you want to try it out. The reason I haven't enabled it by default is that I've found it kind of slow and I'm not sure it's actually an improvement over the current method. Let me know what you think. [Add a keyword to this script filter if you'd like to try it out] Novelty: Added (unofficial) Antarctica flag to flag repository. (Try tz south pole. ) ---- 2 April 2013 — UPDATE to v1.61 Small fix for Dutch (Netherlands) flag matching. ---- 22 March 2014 — UPDATE to v1.7 City List now always shows in the same order. (Achieved by removing “uid” parameter.) Removed Alleyoop updater. ---- 22 March 2014 — UPDATE to v1.7a New 256x256px icon
  6. This is a workflow to mount your network shares with automatic discovery. No configuration or bookmarks required! Download — stable version. Please report problems here. Your computer won't explode and your shares are safe, I promise. Troubles? Make sure that both, Apple Filing Protocol (afp) and Samba (short smb, QNAP calls it "Microsoft Network") are enabled on your NAS. Due to the nature of the protocols and the available tools on OSX, both of them are required in order to disover network shares in your network. Also note that already mounted shares are not listed in Alfred. Enable guest access to the NAS, not for a specific share, but for the system in general if things don't work. The source code is available here: https://github.com/pstadler/alfred-mount
  7. Alfred Maestro Possibly the last workflow you will ever need for system tasks I recently started using Keyboard Maestro (KM), and so far I love it. So I made this workflow to allow you to execute any KM macro straight from Alfred. Downloads - My Site: http://iansinnott.com/blog/integrating-alfred-and-keyboard-maestro/ - GitHub: https://github.com/iansinnott/keyboard-maestro-alfred Basic Usage Type 'km' followed by the name of the macro you want to trigger. Dependencies Keyboard Maestro More Info Check out the readme in my Github repo linked above. Also, check out my blog post about these two apps if your interested in how I actually use it. That's also linked above as the first download link. Quick Note: I only tested this on the latest version of php (5.5.5 as of this writing). This is not the standard installed version that comes with new Macs, so if you have any trouble with the workflow let me know. Cheers, Ian
  8. It's a bit late, so I might just be doing something dumb... But anyways, I have this code in my Script Filter: #!/usr/bin/env bash export PATH="$PATH:$node_path:/usr/local/bin:/usr/bin" node $node_flags javascript-file.js comments "{var:task}" And I'm getting this error: Code 1: undefined:1 {var:task} ^ SyntaxError: Unexpected token t in JSON at position 1 I have an Alfred Variable Object assigning the `task` variable to a value, but I'm not sure how to use it. Could I get some help? Thanks!!
  9. I have a very basic python question that I was hoping to get a little help with that involves filtering out list items in a script filter. At the moment, the script filter works great except that it includes a few items I'd prefer not to see in Alfred's output. Is there any easy way to remove items whose titles can be found in another list? Admittedly, I normally do these sorts of things in AppleScript - which is pretty easy to do in this case - except that I’ve been trying to learn a little python, given all of the limitations with AppleScript (which @deanishe and @vitor have rightly reminded me of on numerous occasions, so hopefully this will make them proud 😃). For example, let’s say that I have the following list: titles_remove = {"Title A", "Title B", "Title C"} And, before outputting my results in Alfred, I’d like to remove all items whose titles can be found in titles_remove. At the moment, my script filter ends with the following line: print(json.dumps(result)) And, it’s JSON output follows the usual format where each item has a title, subtitle, uid, and arg. Now, if I modify that last line so that it’s output is: unfiltered_output = json.dumps(result) What should I do next to remove items whose titles can be found in the titles_remove list? I tried following several different python tutorials, but I kept receiving errors. I suspect that some of the methods weren't intended for dealing with strings. But I'm a complete newbie here. Thanks for any help you can lend! I really appreciate it. And, if anyone has any advice for python newbies that might want to do things with Alfred, I'd greatly appreciate any recommendations on potential resources to check out, etc. Thanks!!
  10. I have a js file that ends with msg = JSON.stringify(result) $.NSFileHandle.fileHandleWithStandardOutput.writeData( $.NSString.alloc.initWithString(String(msg)) .dataUsingEncoding($.NSUTF8StringEncoding) ) When I run the script from the terminal, it returns JSON that appears to be correctly formatted for Script Filter. $ ~/Documents/myscript.js list {"items":[{"uid":"1","title":"OptA","autocomplete":"OptA","subtitle":"OptA","arg":"1"},{"uid":"2","title":"OptB","autocomplete":"OptB","subtitle":"OptB","arg":"2"}]} In Alfred, I created a workflow that contains a script filter. `Alfred filters results` is checked, language set to `bin/bash`, and it is configured to run my JS script: ~/Documents/myscript.js list When I type the keyword into Alfred, the workflow is displayed but no list results are returned. Alfred debugger returns ERROR: Script Filter to Script to Notification[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON: Error: Can't convert types. I assume this means that whatever Alfred has received is not recognised as valid JSON, is this correct? Is there a way to interrogate Alfred to inspect what has been received into the script filter? Or is there a better way to debug this error?
  11. You can have a look at my quick video on the reddit post linked above. I have took some of the code from the existing workflow, and modified it so it can offer me a list of servers as I'm typing. I have took my time adding country flags to the script filter as well. Download: https://mega.nz/file/7TQF3ALR#z-hQhkfrH3dP4xsEmb9seGZPTzd6PcoHC3HN1AaPSus
  12. Hi everyone, I'm learning the fantastic Script Filter input. One big question from me is how do I handle the arguments output of a Script Filter differently? For example, I have an item with the arg "~/Downlaods" which is the Downloads folder path, while another item with the arg "https://www.alfredforum.com" which is really a URL. If I connect this Script Filter with an Open URL action, it will only work for the second item since its a URL but not for the first one. How can I handle these two items differently?
  13. I’m struggling to get a script filter to work which outputs a variable containing a mixture of text and emojis. In the output, Alfred just spits out empty characters for the emojis (⍰ question mark in a box). There’s obviously an encoding issue I’m overlooking, and I haven’t been able to quite put my thumb on it. To explain, I’ve created a script filter with AppleScript that’s supposed to let the user select a playlist from their Apple Music library (to play it, move it, etc). I recently moved over from Spotify to Apple Music, and I have a ton of playlists (put that's a separate problem - ha)! And, as you might guess, some of my playlists include emojis. When I run the script filter, Alfred’s output just shows empty characters where the emoji’s used to be. Consider the following example: Playlist: Radiohead ⭐ Faves Script Filter/Alfred Output: Radiohead ⍰ Faves Debug: Radiohead \u2b50 Faves So, while most of this is over my head, from what I understand, my JSON output is being spit out as formatted for C/C++/Java Src (when it should be in the usual utf8 unicode format). Any suggestions for fixing it? I've never tinkered around with JSON.scpt file that does all of the heavy lifting, so hopefully it's just a minor issue with my code. Admittedly, I’ve always been confused about how JSON and AppleScript work together. Although I’ve been able to create script filters in the past thanks to everyone’s help, I’ve never made one that dealt with text that containing emojis. Thanks for any help you can lend! For testing purposes, I’ve uploaded a test workflow here: https://share.getcloudapp.com/xQuDN0dl. And, here's screenshot of its script filter:
  14. I have a very basic question about how script filters work that I haven’t been able to find a direct answer to on this forum or on Alfred’s support page. To be fair, there’s a ton of fantastic information on both, but I simply haven’t found one dumbs its explanation down enough for me to follow it. I've been using Alfred for quite some time, but have never been able to understand much about script filters. In short, I was wondering how to get items from an AppleScript list to show up as JSON formatted items in a script filter’s output (so that I can select one of them, and have it operate like the argument in a subsequent object)? For simplicity, let’s say I have an AppleScript that generates the following list: {"Red", "Green", "Blue”} But, in practice, that list will be dynamically produced and longer. In other words, I can't get away with just manually listing each item in the script filter (like in Alfred's jsonformat workflow example: Getting Started/Script Filter). Based on this example, how do I get the script filter’s output to operate like the following? Item 1 Title: Red SubTitle: Same Words Red Argument: Red Item 2 Title: Green SubTitle: Same Words Green Argument: Green Item 3 Title: Blue SubTitle: Same Words Blue Argument: Blue To illustrate, here’s what the output might look like when created with a list filter: *** @deanishe, I tried following your helpful advice and added a json.scpt file from another workflow that also used this approach. However, I couldn’t quite figure it out. Is there any way that I could talk you - or anyone else - into walking me through this, using the following example? 🙏 Based on the example above, I’ve created a very basic workflow to help illustrate things (for myself and others): Download Workflow. The workflow contains: (1) a script filter and (2) a list filter. The script filter has been stripped down to a single line of code that sets a variable to the afore mentioned list above (set theList to {"Red", "Green", "Blue"}) (AppleScript). In other words, I removed all of my failed attempts, and have only included this line in the AppleScript as a starting point (I understand there’s more to be done here). As for the list filter, it was included to illustrate how I’d like the script filter to perform (i.e., its output). I understand that if the string/list was fixed, that I could always just use it (instead of a script filter). Again, this was added strictly for illustrative purposes. To keep things simple, both filters simply copy their output to the clipboard. So, if you select the “Green” item from Alfred’s output, it would copy the word “Green” to the clipboard. In practice, this would be connected to another object that would do something else with the variable. But this struck me as an easiest way to test things. Can someone help walk me through how to set up the script filter so that it operates like the list filter (using an applescript list of variables)? Thanks in advance for any help you can lend! I really appreciate it.
  15. I just released a Screen Sharing workflow with automatic discovery of hosts that have remote desktop enabled. Such amazing things are now possible thanks to the "Script Filter" input! Download — stable version. The source code is available here: https://github.com/pstadler/alfred-screensharing
  16. Inspired by Don Southard's Screen Sharing Workflow for Alfred v1 I have made VNC workflow using Alfred 2 dynamic list feature. First of all here is the download → link To add machines simply write vnc setup and after space insert machine name, its IP address and optionally port, exactly like that: Name-IP_address:port for example: Living Room- To delete machines write vlc delete and choose from list which machine you would like to delete. Please, feel free to comment, to give some hints, etc.
  17. Alfred's default handling of workflow variables set by modifiers is … odd. Setting variables via Script Filter feedback at the top level and via items behaves sensibly, and as you might expect. Namely, they are merged with existing variables, overwriting any of the same name. Setting variables via mod does something completely different. If you set any variables via a mod all other variables created during the execution flow (i.e. set anywhere but in the configuration sheet) are dropped on the floor. Not just top-level variables, but also pre-existing ones set upstream via Args & Vars or a Hotkey or passed in via an External Trigger. This is counter intuitive, counter to the way variables set elsewhere work, and I don't see an actual use case for mods to behave that way. It's fine that variables set by item the mod belongs to are not set when a mod is used, but top-level variables should not be ignored, imo, and existing variables from upstream should definitely not be deleted. I would suggest that mod variables should be handled the same way as item variables and be merged with top-level variables and existing variables from upstream.
  18. This is my error : [ERROR: input.scriptfilter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON: input the {"items":[]} "input the" is the result of code "echo $userInput This Alfred node, runs a script called search.rb. I've screen shotted it below as well. The script calls all redbooth API's(a project management app) Projects, Tasklists and tasks. It then runs a loop through each item and looks for titles that match the user input/ARGV. I have run the script locally in my terminal and the script returns the correct objects and should be printing them/returning to Alfred. However I get the above issue and I can't seem to figure out where my disconnect is. Additional info/screen shots below. search.rb/the script alfred runs to generate the script filter options. This code(below/list_proj.rb) calls the redbooth API and takes all returned objects/projects and converts the data to json. When the script rubs as is in a alfred script node- it populates the filter options. This code works to the desired effect. Posting for comparison This is a snap shot of the work flow. Everything works with the exception of the Search function/nodes Please let me know if I can provide anything else. I have a separate plugin that provides user auth for the work flow to access the redbooth client API. Any insights to this error or what I may have missed would be well appreciated. Thanks!
  19. Since this is what I think the standard way to set an environment variable from a Script Filter, I think this should be working, but feel free to move this post to the feature request if this the normal behaviour and not a bug. When building a workflow that works with files and folders, I like to allow to run actions on those files/folders. So, since the File Action is made for that, I like to just activate it on my script filter output item by using my File Action shortcut (sets to cmd-cmd in my case). However, when I want to set an environment variable inside the Script Filter, then the File Action shortcut doesn't work anymore even if "type" is set to "file" in the JSON. Since this environment variable is used when I normally activate the selected item on my workflow by pressing enter and could change based on which item of the Script Filter is activated, I need to set it inside the Script Filter and not after or before, but would like to keep the default behaviour of the " 'type': 'file' " item. Here is a workflow to demonstrate this: https://nofile.io/f/xZGFinuS44I/Script+Filter+-+File+Type+with+File+Action+-+Test.alfredworkflow Let me know if something isn't clear enough! Best!
  20. Alfred 3.4 (850) type = file is ignored on feedback items when workflow variables are also set via arg (i.e. arg is a JSON-encoded alfredworkflow object). Run the following workflow or build your own Script Filter around the JSON feedback. You can hit right-arrow on the first item with a "plain" arg to access File Actions. File Actions don't work on the second item, however. Demo workflow. Script Filter feedback: { "items": [ { "title": "Path, no vars", "subtitle": "This works with File Actions", "type": "file", "arg": "~/Desktop" }, { "title": "Path, with vars", "subtitle": "This doesn't work with File Actions", "type": "file", "arg": "{\"alfredworkflow\": {\"variables\": {\"var1\": \"val1\"}, \"arg\": \"~/Desktop\"}}" } ] }
  21. I'm not sure if this is a bug, but I'm trying to get a query with multiple spaces in it and "as is" (meaning that I want the the left and right trailing spaces). Right now, Alfred trim the spaces to only one if multiple are inserted at the beginning or end of a query. This is working if using a "keyword input" so it seems to be a problem with the script filter input method. I've tried using the "with input as argv" or "with input as {query}" and both output the same. Here is my test script for the Script Filter input (using Python): import sys, json query = sys.argv[1] #query = """{query}""" # uncomment if trying with "with input as {query}" data = { 'items': [{ 'title': "Script Filter: The query is '" + query + "'", 'arg': query }] } sys.stdout.write(json.dumps(data)) Here is a screencast to show the problem: https://NoFile.io/f/4334MTCdPQ5/Alfred-SpaceInQuery-Problem.mov Is this a bug or there's something I'm not doing well or it's just not possible with the Script Filter input ? Thanks!
  22. I'm trying to figure out how to trigger an action from a script filter in the event that there's no match. I've hacked together a workflow (hotkey: cmd+shift+2 --> script filter) that allows me to manage text keywords/tags, and I'm trying to refine it further. Currently, the script filter I've cobbled together selects existing keywords/tags from a json file and pastes them wherever the cursor is placed or, if an action modifier is invoked at point of selection, deletes the selected keyword from the json file. I've already figured out a separate workflow that can allows me to add a keyword to the json file, but I'd like to everything to be triggered by the same hotkey. Any pointers? Thanks in advance for any help!
  23. Alfred version 3.2 pre-release (757) It's a little hard to explain, so here's a workflow to demonstrate the bug. And a screenshot: When External Trigger "target" is called the first time via the top row of elements, the variables are correctly passed to the red Script Filter. However, when the red Script Filter calls itself via the same external trigger, no variables are passed to the Script Filter by External Trigger "target". The variables are passed to Debug and Run Script objects (not visible in the screenshot). arg/query is passed correctly. EDIT: Here's the bug in action:
  24. I’m trying to create a workflow that will display the current time when I type "time" into Alfred. I can’t figure out how to use a bash variable within the JSON object in the heredoc. This is what I have but the item doesn’t show. If I add other fields the one with the variable remains empty. time = date "+%H:%M %p" cat << EOB {"items": [ { "title": $time } ]} EOB I’ve also tried "$time" and '$time' but nothing works. I feel like I’m missing something basic.
  25. I've run into the situation with a bunch of my workflows where I like to return a status line of sorts. For example on my emoji workflow I show a match count. I use the `valid=False` command to make sure you cant interact with it but it still gets a ⌘1 hotkey. I suggest the following possible change: Could there be a flag such as `header=True` and this item would serve as a header item. You could only have a single header per results returned and if you had multiple it would just take the last one (or the first one) and render it like a header line. It would not be assigned a hotkey but would server as a header of sorts. (just an idea)
  • Create New...