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


Forums

  • 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

Categories

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

Categories

  • New Features
  • Other

Found 48 results

  1. 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!
  2. 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!
  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. 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:
  6. 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!
  7. 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.
  8. 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)
  9. 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.
  10. 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
  11. 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
  12. 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.
  13. 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.
  14. 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
  15. Hi I have question regarding the "Alfred filters results" script filter option. Does it support fuzzy filtering?
  16. 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.
  17. 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.
  18. 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
  19. 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
  20. 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!
  21. Hi, I have a Script Filter that populates xml results with my pre-defined items, and after selecting one of them, it creates new Mail.app Message (using NSAppleScript) with pre defined text, & subject text (that comes as an argument from Script Filter). The problem is that sometimes my Workflow stops working right after I choose one of ScriptFilter's results. It doesn't continue to (NSAppleScript) Action. Debug shows no errors, and the last logged text line is this: [INFO: alfred.workflow.input.scriptfilter] Processing output 'alfred.workflow.action.applescript' with arg 'First test title' Does anybody have experienced similar problem in the past? Thanks in advance, Romans
  22. Hi, I have a Script Filter with a keyword "KC" that populates results (using php and xml) with items I defined. This is working fine, except the fact that it also shows some unwanted items among my defined results. For example "Key Codes.app" - it shouldn't be there, but Alfred still shows them, probably because this app has letters K and C in it's name. This doesn't make sense. That's completely fine with me if Alfred show other apps like Komodo, Key Codes, Keychain Access, etc. when I start typing my keyword by typing "K". But when I finish typing my keyword "KC" it switches to my Workflow and displays results I defined. So why I still get "Key Codes.app" among these results? Thanks in advance, Romans
  23. Hi, I'm currently working on a Script Filter. The settings are as follows: - with space - argument optional Everything works fine if the argument doesn't contain a space but if it does the workflow is not called and instead only the fallback searches are available. I escaped spaces in query but it didn't help. Can you tell me what I'm doing wrong?
  24. As best as I can tell, any output to STDERR will cause Alfred to prefix the output with [ERROR: alfred.workflow.input.scriptfilter] in the debugger. While more experienced users/developers will recognise that [ERROR: alfred.workflow.input.scriptfilter] Code 0: (especially if Alfred also show results) means that there wasn't actually an error, this behaviour is misleading for less expert users because Alfred's debugger says there was an ERROR when there actually was none. Alfred should not automatically prefix output to STDERR with ERROR. ERROR should only be printed if the exit code is non-zero and/or the returned XML was invalid. Otherwise it's misleading and causes users to report errors that aren't errors. There may well actually be something wrong, but as Alfred's default behaviour is the same in the case of zero results and an actual error (i.e. show fallback searches), it can easily result in users reporting an "error" when they're just getting an empty result set. I'm posting this in Bug Reports because it's logically wrong to report ERROR when there isn't actually one.
  25. Currently there are some issues with Run Script when using /usr/bin/php, /usr/bin/perl, /usr/bin/python, etc... Those processes are launched from the shell using certain environment variables (such as LANG=C or another non-unicode supporting environment) which disable features or environments we may need to run our scripts correctly. Currently the only solution to this would be to use /bin/bash or /bin/zsh and set things ourselves and then launch our script from there. Doing so means we sacrifice the convenience of having scripts right in the workflow visual themselves AND we can no longer take in the query conveniently. We must now take in the query through bash for example, which is quite tricky (an experienced programmer may be ok, but just try taking in something like She said, "He said, 'this is fantastic!' ", and you'll see things are much worse than what is apparent). To save us from this mess, we could have a vertical dual pane Run Script, where the top pane is a bash or zsh, and the bottom one of the script languages. Users can then easily set any setup variables they need to make things run smoothly. Thanks kindly, Matthew
×