Jump to content

Rigonatti

Member
  • Posts

    11
  • Joined

  • Last visited

Contact Methods

  • Twitter
    http://twitter.com/rigonatti

Profile Information

  • Location
    Brasil
  • Interests
    Producvity

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Rigonatti's Achievements

Helping Hand

Helping Hand (3/5)

1

Reputation

  1. I'm probably wrong, but couldn't see that working. since each note has a 'template', the URL would be something like open "bear://xcallback-url/add-text?title={arg from filterlist}&tag={the tag relative to arg from filter list}&text={query} on: ${dateap} @ ${timeap} ie: If I choose "books" from List Filter, I should have an URL with title=Books and tag=books. But Filter List only allow me to pass 1 parameter per option, right? I think I'm going to end up in a need of a script. and back do scratch to learn how to do it. ..
  2. ops! sorry! I've posted the wrong code version. Re-postiing to make it clear : # Import Sys to sus.stdout import sys import json import requests # Importing Variables from os # import os # Connecting to the Short IO API Links: url = "https://api.short.io/api/links?domain_id=182191&limit=5&dateSortOrder=desc" headers = { "accept": "application/json", "Authorization": "SHORT_API_KEY" } response = requests.get(url, headers=headers) alfred_items = [] for item in response: result = { "uid": item["id"], "title": item["title"], "subtitle": item["originalURL"], "arg": item["id"], } alfred_items.append(result) response = json.dumps({ "items": alfred_results }) sys.stdout.write(response) The debugger: [08:16:52.188] Short URL[Script Filter] Queuing argument '' [08:16:53.817] Short URL[Script Filter] Script with argv '' finished [08:16:53.822] ERROR: Short URL[Script Filter] Code 1: Traceback (most recent call last): File "PATH/user.workflow.7D5AFBA8-06E5-449C-8F09-087F9369FB5C/search.py", line 25, in <module> "uid": item["id"], ~~~~^^^^^^ TypeError: byte indices must be integers or slices, not str
  3. So, I ended up getting back to python3, per @vitor recommendation. The code now is: import requests import json # Importing Variables from os # import os # Import Sys to sus.stdout import sys # Connecting to the Short IO API Links: url = "https://api.short.io/api/links?domain_id=182191&limit=5&dateSortOrder=desc" headers = { "accept": "application/json", "Authorization": "SHORT_API_KEY" } response = requests.get(url, headers=headers) alfred_items = [] for item in response: result = { "uid": item["id"], "title": item["title"], "subtitle": item["originalURL"], "arg": item["id"], } alfred_items.append(result) response = json.dumps({ "items": alfred_results }) sys.stdout.write(response) But, the Debugger keeps getting this message back: [17:49:45.183] ERROR: Short URL[Script Filter] Code 1: Traceback (most recent call last): File "/Users/thiagorigonatti/Dropbox/Alfred Settings/Alfred.alfredpreferences/workflows/user.workflow.7D5AFBA8-06E5-449C-8F09-087F9369FB5C/search.py", line 24, in <module> "links": item["links"], ~~~~^^^^^^^^^ TypeError: byte indices must be integers or slices, not str I've tried a few ways to solve it, but couldn't be successful. In time. The JSON API response bellow:
  4. Thanks for your help @vitor. Before trying libraries I did try to write requests manually . Here is the link with the script workflow: ShortIO When I Try to run, the Debugger says only: [12:25:40.921] Short URL[Script Filter] Queuing argument '(null)' then, Alfred is frozen and a Have to force quit and reopen .
  5. I'm pretty new (and curious) about Python and recent rediscover Alfred. I've installed the Alfred Librarys from @deanishe What I am trying to achieve is to get a list of last links created, when user type shsearch, and when select an specific result, pass the id to the next workflow. My code is now like this: And i've been trying a lot of ways to parse the results to Script Filter Json format, but couldn't move on. So, any tips that can help me will be highly appreciated. I'm also attaching my workflow, just in case. Short URL v1.1 import requests import sys import os from workflow import Workflow, ICON_WEB, web url = "https://api.short.io/api/links?domain_id=182191&limit=5&dateSortOrder=desc" headers = { "accept": "application/json", "Authorization": os.getenv('SHORT_API_KEY') } response = requests.get(url, headers=headers) response_info = response.json() def main(wf): url = 'https://api.short.io/api/links?domain_id=182191&limit=5&dateSortOrder=desc' params = dict(Authorization=os.getenv('SHORT_API_KEY'), format='application/json') r = web.get(url, headers=params) # throw an error if request failed # Workflow will catch this and show it to the user r.raise_for_status() # Parse the JSON returned by pinboard and extract the posts result = r.json() link_list = result['link_list'] # Loop through the returned posts and add an item for each to # the list of results for Alfred for link in link_list: wf.add_item(title=link['title'], subtitle=link['shortURL'], arg=link['id'] icon=ICON_WEB) # Send the results to Alfred as XML wf.send_feedback() if __name__ == u"__main__": wf = Workflow() sys.exit(wf.run(main))
  6. I'm creating an Alfred Workflow to allow me to add a line to a note. As an example: A note with the tag #books-to-read - Getting search results with the #books-to-read - Append {query} to the note selected. I have managed to create an append by running a bash script with the title of a specific note. However, my goal is to filter and show specific tags and notes under it, then append the text based on the user's selection. Consider this example: - User starts workflow; - User see a list of an tag (lets says "#running-notes") -User select the "Books" Note - User types {query} to be append to the note "Books" under "#running-notes". Here is the code I'm using to append, right now: open "bear://x-callback-url/add-text?title=Books&selected=no&mode=append&new_line=yes&open_note=no&exclude_trashed=yes&new_window=no&show_window=no&edit=yes&timestamp=no&clipboard=no&text=%0A%0A%3E%20($(query}%3A%20 ${title} %20%0A%3E%20Added on: ${dateap} @ ${timeap}" Does anyone have a clue on how that can be done? Cheers
  7. Hi @Vero Thank you so much for the tips. I've created and workflow using (only) Alfred's Automation Tasks. I'm glad that you answered so I also included a small thank-you note on the credits mentioning you. (Please, let me know if the links are correct). I'm gonna try to figure out the best language to create a script to build a setup menu that can't customize the 'Workspaces Names' and also show a list of apps installed that can't be added to the workspace trough Alfred spotlight. If you have any other suggestion to improve or correct anything. Just let me know. Here is the WorkFlow Momentum Workspace Launcher Txs again,
  8. Hello There, I'm new on Workflows and know nothing about Ruby. So I was wondering if is possible to setup a keyword that can kill a group of pre-selected apps. For example: I use a keyword to launch my Work Environment: - launch Excel - launch WinWord - launch my company web site. When I'm launching my Personal Environment, I want the script or the keyword to: - kill Excel - kill Winword - Launch my Notes App - launch my personal website Its that possible? I'm using Alfred5 currently. I found Kill Process Workflow great to use, but I can't set to kill multiple process with a single keyword
  9. Hello all, Here is my humble high contrast Theme. hope you like it! You can download it Here
×
×
  • Create New...