Jump to content

Search the Community

Showing results for tags 'script filter'.

More search options

  • 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
  • Alfred v2 Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting


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


  • New Features
  • Other

Found 47 results

  1. 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!
  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. 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\"}}" } ] }
  4. 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!
  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. 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.
  7. 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
  8. 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!
  9. 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:
  10. 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.
  11. 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)
  12. Hi everyone. I have a bash script that looks up my bookmarks on Pinboard.io and returns correctly formatted xml. Although the script outputs to stdout immediately, Alfred doesn't pass the output to the script filter until the whole (longer running) script has finished and returned. Is there a way to avoid this delay? Cheers, Teo
  13. Hi All, I have looked on the web for the answer to this and have not found what I am looking for. My problem is this: When I start a workflow execution that requires and argument, I want to search my clipboard history for that argument. Since I have already called up alfred with 'Command'+'space' and typed my workflow in, when I go to input the argument needed I want to again enter 'Command'+'alt'+'C' to search my history for the argument. Once I do this, alfred's state change to the clipboard history and I can't return to where I was before with the start of the workflow. Of course the workaround is to make sure the argument I need is already the first item in my clipboard history so I can easily just paste it in without searching, but it would be nice if I could search. It decrease my error rate during clutch situations for sure. Let me know if I am not clear in my question. Thanks! Dave
  14. Hi, I'm using Alfred 3's Script Filter + JSON format to return a list. However, I found that despite I output a static ordered list, the ordering that display on Alfred is dynamic. That is, Alfred seems to alter the ordering. It looks like Alfred tend to put the most recent used item to the top. I'm wondering if there is any way to configure this behavior or turn it off? Thanks.
  15. I have a script filter that outputs a value. When passing this value into a downstream script filter, the argument is only available (via sys.argv) if the "Alfred filters results" box is unchecked. When checked sys.argv[1] throws an index out of bounds error. When not checked, the argument is available as expected.
  16. Good morning, I'm currently trying to create a simple Script Filter Alfred 3 Workflow using Python. I found an earlier example which demonstrated how to pass XML results to a Python workflow: xmloutput = """ <?xml version="1.0" encoding="utf-8" ?> <items> <item arg="testitem"> <title>FooBar</title> <subtitle>foo bar is a test item</subtitle> <icon>icon.png</icon> </item> </items> """ print(xmloutput) My question is, what is the syntax for doing the same with the new JSON data structure? regards, Andrew
  17. Hi I have question regarding the "Alfred filters results" script filter option. Does it support fuzzy filtering?
  18. VNC Workflow

    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.
  19. Hello. Today I've experimented with Safari's windows management through Alfred & AppleScript and encountered with greatly strange issue. As you probably know, every window object in AppleScript has standard properties which are described in Standard Suite: id, name, miniaturized and the like. In Script Editor I can obviously get any of these properties and I thought I can do the same in Script Filter too. However when I try to get miniaturizable and miniaturized properties in a Script Filter's script, the script fails with an error "Safari got an error: Can’t make |miniaturized| of item 1 of every window into type reference." under number -1700. I've created this simple example to illustrate the issue: repeat with safari_window in every window of application "Safari" try log (get miniaturized of safari_window) on error msg number -1700 log msg end try end repeat When I run it in Script Editor it executes as expected and logs true/false values, but when I call it from Script Filter it produces errors and logs error messages: [STDERR: alfred.workflow.input.scriptfilter] Safari got an error: Can’t make |miniaturized| of item 1 of every window into type reference. Safari got an error: Can’t make |miniaturized| of item 2 of every window into type reference. Safari got an error: Can’t make |miniaturized| of item 3 of every window into type reference. Safari got an error: Can’t make |miniaturized| of item 4 of every window into type reference. Safari got an error: Can’t make |miniaturized| of item 5 of every window into type reference. Safari got an error: Can’t make |miniaturized| of item 6 of every window into type reference. Safari got an error: Can’t make |miniaturized| of item 7 of every window into type reference. Also it isn't a Safari issue. Other applications behave the same way. Can someone explain me, why is it happening? Thank you.
  20. Hello. I try to write my first script filter plugin, but I've encountered a unexpected trouble with Unicode (non-ASCII) characters. This is a simplest example I could invent: xmloutput = """ <?xml version="1.0" encoding="utf-8" ?> <items> <item arg="testitem"> <title>FooBar</title> <subtitle>foo bar is a test item</subtitle> <icon>icon.png</icon> </item> </items> """ print(xmloutput) (I call it from script filter as /usr/local/bin/python3 outputtest.py.) It works fine until I want to add some non-ASCII characters: xmloutput = """ <?xml version="1.0" encoding="utf-8" ?> <items> <item arg="testitem"> <title>FooBær</title> <subtitle>foo bær is a «test item»</subtitle> <icon>icon.png</icon> </item> </items> """ print(xmloutput) Then it fails: [ERROR: alfred.workflow.input.scriptfilter] Code 1: Traceback (most recent call last): File "outputtest.py", line 12, in <module> print(xmloutput) UnicodeEncodeError: 'ascii' codec can't encode character '\xe6' in position 88: ordinal not in range(128) Why it happens? I can't believe that Alfred do not use Unicode in input/output. I think the root of problem in something else, but I can't find out where is it.
  21. Is there a way to map output actions to specific items without having to use action modifiers? I have a script filter that I am using in alfred and I want each item to have its own return output. For example, if I press enter on the first item, I want it to copy to the clipboard and post a notification. I want the second and third item to not return anything. I want the third item to launch terminal when the user hits enter. I want the fourth item to launch a webpage when the user hits enter. IP=$(host google.com | cut -c 30-) CITY=$(curl http://ipinfo.io/$IP/city) STATE=$(curl http://ipinfo.io/$IP/region) PROVIDER=$(curl http://ipinfo.io/$IP/org | cut -c 8-) //Start Display cat<<EOB <?xml version="1.0"?> <items> //Remote Server's IP <item arg="$IP" valid="NO"> <title>Remote Server's IP: $IP</title> <subtitle> Press Cmd + C to copy </subtitle> <subtitle mod="cmd">Cmd + C to Copy</subtitle> <text type="copy">$IP</text> <icon>69288C18-2A0D-4430-837E-4AB331CD2698.png</icon> </item> //Location (City, State, Country) <item arg="$CITY, $STATE" valid="NO"> <title>Location: $CITY, $STATE</title> <subtitle>This is Location of the Server</subtitle> <icon>icon.png</icon> </item> //ISP Provider <item arg="$PROVIDER" valid="NO"> <title>Provider: $PROVIDER</title> <subtitle>This is the ISP Provider</subtitle> <icon>Wired_Network-100.png</icon> </item> //SSH into server <item arg="$IP"> <title>SSH into Server</title> <subtitle>Press Enter to connect</subtitle> <icon>Connected-100.png</icon> </item> //Open Web Page <item arg="$IP"> <title>Connect to Web Server</title> <subtitle>Press Alt + Enter to connect</subtitle> <subtitle mod="alt">Launch Webpage</subtitle> <icon>Open in Browser-100.png</icon> </item> </items> EOB
  22. 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
  23. I'm trying to make my workflow robust against special characters, and I'm having a bit of trouble. When I run my python script from the terminal with an argument containing special characters it works fine. Eg: python alfredwl.py show "a´´´´ÅÅÅ´´ÅÎÎÎÏÍÒˆ„ÏıÔÍÓÔÍÏıÅͯÅÍåå∂ß˚˜≤√åß" However, when I run it through Alfred as "wlshow a´´´´ÅÅÅ´´ÅÎÎÎÏÍÒˆ„ÏıÔÍÓÔÍÏıÅͯÅÍåå∂ß˚˜≤√åß" in a script filter my workflow seems to stumble on the character encoding. In my python script I convert arguments from UTF-8 into Unicode strings--I figured that would've worked for Alfred. What type of encoded string does Alfred's script filter pass onto the Bash script running? Thanks, Nick
  24. Hi! I'm an alfred noob, and not much of a programmer - so I was wondering if someone could help. I'm looking for a way to search top level folders in a specific directory only - and exclude its children - I'm guessing with a script filter. Context - We do a lot of development locally and I am often having to type in http://localhost/foldername to open the local instance of a website. Because there are so many its a bit of a pain in the proverbial. I've managed to cobble together a script that searches my localhost folder and opens the folder name (as $filename) at http://localhost/$filename I'm using the file filter, which returns all the sub folders in my localhost - I'm guessing I need to write a script filter that ignores sub folders and only looks for top-level directories in the localhost directory. thanks!
  25. Hey guys, Say I make a Script Filter and link it to 4 script actions that each perform a different function, but each action needs a different input from the Script Filter, and this is where the problem begins, because the "arg" attribute can hold only one value which will work with just 1 of the 4 actions Right now the only workaround to this problem is to give the "arg" attribute a separated list of multiple values, and then each action would need to parse the input and search for its piece of data, but it's too much parsing and splitting involved.. My opinion is that we should have some freedom in the XML attributes of the feedback results by letting us define our own attributes in a result and Alfred would automatically send those attributes as individual parameters to the "alfred_script" function, as well as individual {attribute_name} to other predefined actions. For example, script filter would generate this xml result: ... <item uid="rdioartist" arg="r96664" valid="yes" autocomplete="Incubus" artistiname="Bjork" track="All is full of love"> ... And we, the programmers, would then use the following in script action: on alfred_script(arg, artistname, track) -- we use the parameter that is needed for a specific action end alfred_script [later edit]: a big problem with the current design is when you link a script filter to multiple actions AND a Notification action, because inside the Notification action we can't split the separated list of values of the "arg" attribute, and setting the arg attribute to a single value would make the other actions useless So with my suggestion above we would type something like {aristname} or {track} inside the Notification action