Jump to content

raeserbil

Member
  • Posts

    4
  • Joined

  • Last visited

Everything posted by raeserbil

  1. Of course I can rewrite my python script to output what I want to display in this case, but I was hoping to avoid this and handle it in Alfred Workflow. if ("output from my script used in the script filter" == "N/A"): call my script with another argument and dont display N/A else: display output in Alfred result
  2. I can output whatever I want in my script, it does not have to be N/A. I will try to explain what I am trying to achive: I am totally new to Alfred Workflows and just trying to figure out how it works. What I want to achive is this: I have a tree of 3 levels. For example: - Soccer -- England --- Div 1 --- Div 2 -- Italy --- Div 1 -- Spain --- Div 1 - Basketball -- NBA -- Turkey --- Div 1 - Tennis -- Grand Slam All of these elements in the tree has a uniqe id. My python script takes the id as an argument and returns the child tree for the speciefied id. For example: /usr/local/bin/myscript -id 1 # Returns all root tree levels, e.g. Soccer, Basketball, Tennis /usr/local/bin/myscript -id 456 # id 456 for Soccer # Returns all tree on level 2 for Soccer, e.g. England, Italy, Spain /usr/local/bin/myscript -id 789 # id 789 for England (in Soccer) # Returns all tree on level 3 for Soccer - England, e.g. Div 1, Div 2 /usr/local/bin/myscript -id 99999 # id 99999 does not have any sub trees # Returns N/A In my workflow I first use a script filter with argument 1 to get all root trees and display them in the result. If I then select Soccer I use antoher script filter with argument 456 to display 2nd level England, Italy, Spain. The problem is that there is not always 3 levels in the trees. In this example, if I select Basketball and then NBA, then the script filter running my python script with argument 111 for NBA will return N/A and hence display N/A. In this case, I do not want to display N/A. Instead, I want to execute my python script with an argument that returns for example all the teams in NBA. Of course, in the case that the selection only contains 2 levels, I can just display N/A and select that and then after that do what I want. But what I am trying to achive is to not display N/A. Does this make sense?
  3. Maybe I did not explain myproblem correctly. I have this script filter in my work flow. The script filter executes this: /usr/local/bin/myscript -id 789 If the output is { "items": [ { "arg": "null", "title": "N/A", "subtitle": "N/A", "icon": { "type": "filetype", "path": "/Users/ml/null.png" } } ] } I do NOT want to show "N/A" as a selectable option in Alfred. Instead I want to do something else (trigger myscript with another set of arguments and show that output instead)
  4. I have a workflow in Alfred that uses a python script I have written. The workflow shows the output from the python script in Alfred. However, the input to the python script being executed can sometimes return "null". In that case, I want the workflow to take another path. The normal output is like this: { "items": [ { "arg": "123", "title": "car", "subtitle": "car with id: 123", "icon": { "type": "filetype", "path": "/Users/ml/car.png" } }, { "arg": "456", "title": "boat", "subtitle": "board with id: 456", "icon": { "type": "filetype", "path": "/Users/ml/boat.png" } } ] } In Alfred, car and boat is displayed and if car is selected I trigger another script filter with the id from the car, 123, as input to the python script and display the result of that. But if the result in first case is not car and boat, but instead: { "items": [ { "arg": "null", "title": "N/A", "subtitle": "N/A", "icon": { "type": "filetype", "path": "/Users/ml/null.png" } } ] } Then N/A is displayed in Alfred. But in this case, I want to take another path to to trigger my python script with another set of arguments. How can I do that in Alfred?
×
×
  • Create New...