Jump to content

Search the Community

Showing results for tags 'python'.

  • 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
    • Workflow Advanced Tips & Tricks
    • Workflow Automation Tasks
  • Alfred Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting

Categories

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Twitter


Website URL


Jabber


Location


Interests

  1. Description Equivalent of the mobile versions of Google Authenticator: https://itunes.apple.com/en/app/google-authenticator/id388497605?mt=8. I personally use it on Gmail, Amazon AWS, Github, Evernote and Dropbox A bigger list is available on Wikipedia: http://en.wikipedia.org/wiki/Two-step_verification There is also a Pam module project on Github: https://github.com/nlm/pam-google-authenticator Non-exhaustive list of links for "secret" installation Google: http://www.google.com/landing/2step/ Dropbox: https://www.dropbox.com/help/363/en Evernote: http://blog.evernote.com/blog/2013/05/30/evernotes-three-new-security-features/ Github: https://github.com/blog/1614-two-factor-authentication Amazon AWS: http://aws.amazon.com/iam/details/mfa/ Facebook: https://www.facebook.com/settings?tab=security Dependencies Python>=2.7 System Modifications Create a ~/.gauth file with your secrets, ie: [google - bob@gmail.com] secret = xxxxxxxxxxxxxxxxxx [evernote - robert] secret = yyyyyyyyyyyyyyyyyy It's also possible to add credentials with "gauth add [account] [secret]" from Alfred Source Code: Github https://github.com/moul/alfred-workflow-gauth Download Links Packal: http://www.packal.org/workflow/gauth-google-authenticator Direct link: https://github.com/packal/repository/raw/master/com.alfredapp.moul.gauth/google_authenticator.alfredworkflow Screenshots Acknowledgments Original alarm clock iconAlex Auda Samora from The Noun Project Licensed under Creative Commons Attribution Status & signs iconsHereldar Terkenya Licensed under a Creative Commons Attribution-Share Alike 3.0 License Original source codeManfred Touron Serial contributorGilberto Olimpio License MIT
  2. Hi, I converted the original workflow posted here and in the DEVONthink forum so that it no longer needs Python installed. Instead, it uses JavaScript and osascript. Please see my original post in the DEVONthink forum for more details. The workflow probably still contains bugs, and it doesn't support global variables yet. So please let me know about any bugs, inconsistencies etc., preferably by PM. I introduced new keyboard shortcuts (prefixed with "DT" instead of the original "DN") so that you can use both the original and the new workflow in parallel (to compare results etc.). You can download the workflow here.
  3. Shorten URL (v1.1) - download here Github Page: https://github.com/hzlzh/Alfred-Workflows This workflow support URL shortener like below. You can use Hotkey to trigger without open Alfred input window. goo.gl/ bit.ly/ t.cn/ j.mp/ is.gd/ v.gd/ If you want more URL shortener services added, please let me know, . How-To: Choose some long links (e.g Command + A), then press `Command + Shift +L`, choose goo.gl and you will get the short link in your clipboard with notification center triggered. Tips: How to use this workflow without copy/paste? Just use trigger HotKey, check out this wiki issue here: https://github.com/h...kflows/issues/1 Screenshot:
  4. Ok, I am in the process of re-tooling my workflow development ...erm... workflow. I use Sublime Text 3 and write all my workflows in Python (with some AppleScript occasionally thrown in). My basic question to the community is this: How is your environment set up for Alfred workflow development? But, as that question is perhaps overly broad, here are some specific sub-questions: How do you do version control?do you make the workflow directory the repo? do you do this in Alfred's auto-generated workflow dir (~/[parents]/Alfred.alfredpreferences/workflows/XXXXX-11111/)? How do you structure complex workflows?is the structure similar to the standard Python package structure, with the workflow dir acting as the package dir? if you have multiple scripts, how do you organize them? How do you run/test the workflow as you are building it?in Sublime, with Python, I have problems with imports as soon as I create any structure beyond a flat collection of scripts. I run the scripts from Sublime, not the command line. I need a Custom Build System, does anyone use one for Python alfred workflow devel? There are lots of other specific questions, but my general aim is to just hear from people. Right now, I am re-writing my ZotQuery workflow, which if anyone uses it or has looked at it, you would know that it is big and gnarly. I have most all of the code written, but the workflow's organization is shit. It's far too big to all sit in one script (and still allow me to navigate it). I need some organizational inspiration. So hit me with your setups. stephen
  5. Hi, I was a bit tired of handling all my bluetooth devices manually, and couldn't find any cover-all bluetooth workflows out there, so I made this one. Features: Turn on/off/toggle bluetooth Connect to device from list of paired bluetooth devices Set favorite device for quick access User friendly notifications for all actions Dependencies (see README on git repo): Blueutil Python3 Feel free to give me feedback, and report bugs if you find any. Github: https://github.com/vegardinho/alfred_bluetooth_controller Download: https://github.com/vegardinho/alfred_bluetooth_controller/releases/latest Cheers, Vegard
  6. Philips Hue Controller for Alfred Quickly and easily control Philips Hue lights with Alfred. Installation Download the workflow The first time you run the workflow it will ask you to press the button on top of the Hue bridge then action the item to authorize the workflow to control your Hue lights. The workflow automatically attempts to find the bridge on your local network. You can also manually specify the bridge's IP address. For example, if your bridge's IP is 192.168.1.126: hue 192.168.1.126 Read more about features at the project's Github page.
  7. While there is documentation about the removal of Python in macOS 12.3, I wonder if it would make sense to provide a link to this documentation in the context of this error message? Furthermore, it may make sense to catch these errors on macOS 12.3 and provide a specific error to explain to the user what caused this? Otherwise I think many users will be angry/frustrated at Alfred and won't know what to do next. FWIW, the performance of the scrolling section of this dialog is also very slow/laggy for me... not sure why. Lastly, it seems like, in addition to a redesigned error message as suggested above, it might make sense to add a link to Alfred's documentation about the demise of python when someone selects the [not installed] language here:
  8. Usage Type rr <start> to <destination> in Alfred to find route options. Get Autocomplete suggestions as you type. The search results are displayed one route at a time. Hit Tab key to cycle through all available routes. The first item is the route description, and you can select that option to view full details on the rome2rio web site, or press the Shift key for a preview The items that follow make up the various stops and segments of the trip - press Shift to get a map displayed highlighting the start and end points of each sgement. To reset your search, hit Cmd + Enter on a route description. Or just type rr <start> to <destination> again to begin a new search Download Download from here Notes Powered by rome2rio.com API v1.2 Requires Python 2.x and an active Internet connection If you want to disable autocomplete, open the workflow's script filter node, and change the command to --query from --query-autocomplete (more notes inside the script filter)
  9. Recently, all my workflows that rely on Python scripts stopped working – instead the workflows send me to the fallback (web search). This tells me that the problem is not in the workflow but in summoning Python and running the script. Example: WordSearch (https://github.com/isaacpz/Alfred-WordSearch) and "syn" workflow that searches for synonyms for a queried word, e.g., "syn error" should give mistake, etc. Now it sends me to fallback web search. Syn simply runs the following in bash: "python similar.py ml "{query}". I can see that it is a relative path to "similar.py" – is that the problem (all Python workflows use this)? Something with PATH? The Python install? I'm not sufficiently Python-savvy to figure this out, but it used to work – and I have tried updating python. "python -V" in terminal gives me "Python 3.9.12". Any thoughts? Thanks!
  10. Hi there, I think I tried too many python fixing solutions and broke stuff. I followed this: https://www.alfredapp.com/help/kb/python-2-monterey/ I also reinstalled Git Repos by Deanishe (as an example) from here: https://github.com/alfredapp/updated-third-party-python2-workflows And I still get no worky. Here's the debug: [10:01:27.495] Logging Started... [10:01:36.064] ERROR: Git Repos[Script Filter] Code 1: Traceback (most recent call last): File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/repos.py", line 34, in <module> from workflow import Workflow3, ICON_WARNING, ICON_INFO File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/__init__.py", line 16, in <module> from .workflow import Workflow, manager File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/workflow.py", line 25, in <module> import cPickle ModuleNotFoundError: No module named 'cPickle' [10:01:36.180] ERROR: Git Repos[Script Filter] Code 1: Traceback (most recent call last): File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/repos.py", line 34, in <module> from workflow import Workflow3, ICON_WARNING, ICON_INFO File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/__init__.py", line 16, in <module> from .workflow import Workflow, manager File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/workflow.py", line 25, in <module> import cPickle ModuleNotFoundError: No module named 'cPickle' [10:01:36.353] ERROR: Git Repos[Script Filter] Code 1: Traceback (most recent call last): File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/repos.py", line 34, in <module> from workflow import Workflow3, ICON_WARNING, ICON_INFO File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/__init__.py", line 16, in <module> from .workflow import Workflow, manager File "/Users/***/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9B958AD0-679D-4B2D-99D1-B0AF467B03A0/workflow/workflow.py", line 25, in <module> import cPickle ModuleNotFoundError: No module named 'cPickle' Let me know what other info I can provide.
  11. Hi, Im trying to get a set of isbn-lookup tools (isbntools) from a python/pip package to work inside an Alfred workflow. Ive installed the package locally (inside the workflow folder), and the gist of it is working. Specifically, im able to use alfred to fuzzy search for a book, and get the ISBN number to my clipboard (and past it inside Zotero). But theres a sub-script (isbn_meta) that works the other way around: look up the metadata for a particular ISBN number. It works in my terminal, but im not able to get it to work inside Alfred. The debugger shows that the output of the command (isbn_meta) is not outputting anything; which really doesn't help me figure out whats wrong. I presume it either has to do with the python script not working (which ideally should have printed some sort of error message), or maybe Alfred is not able to pass the output of the command properly. Any ideas on how to fix/troubleshoot this is very welcome. Im not well versed in scripting, so forgive me if theres an obvious answer here.
  12. Under Workflows if I select and edit a script object. There is a drop down list of shells and interpreters called Language, however, you cannot customise them. At the moment the main reason for wanting to do this is to change to /usr/bin/python3 Python2 is to be removed soon and most languages from default macOS installations at a later date(s). This was mentioned in Catalina’s notes as depreciations. This means in the future people will be using Conda, Homebrew etc to add languages to their systems unless Alfred plans to included runtimes. I actually use Homebrew to get newer versions of python, zsh and bash these are a different paths. I just wonder if there is currently a way to add and change them? Some people also use tools like asdf, pyenv, rvm, direnv etc to manage multiple versions of languages.
  13. I'd like to know how to modify the code in order to place the currently entered search word at the bottom of the autocomplete list. Thank you in advance! 🙏 import sys from workflow import web, Workflow def get_dictionary_data(word): url = 'https://ac-dict.naver.com/koko/ac' params = dict(frm='stdkrdic', oe='utf8', m=0, r=1, st=111, r_lt=111, q=word) r = web.get(url, params) r.raise_for_status() return r.json() def main(wf): import cgi; args = wf.args[0] wf.add_item(title = 'Search Naver Krdic for \'%s\'' % args, autocomplete=args, arg=args, valid=True) def wrapper(): return get_dictionary_data(args) res_json = wf.cached_data("kr_%s" % args, wrapper, max_age=600) for items in res_json['items']: for ltxt in items: if len(ltxt) > 0: txt = ltxt[0][0] wf.add_item(title = u"%s" % txt , subtitle = 'Search Naver Krdic for \'%s\'' % txt, autocomplete=txt, arg=txt, valid=True); wf.send_feedback() if __name__ == '__main__': wf = Workflow() sys.exit(wf.run(main))
  14. After much pain, I figured out how to write Alfred workflows in Python which uses the clipboard to transform text, for, for example, reformatting a markdown table. You can check out my repository for instructions and examples: https://github.com/willf/alfred-scripts Feel free to suggest additional scripts! Or tell me an even better way to do it.
  15. Markdown Notes help to manage Markdown files in a directory with powerful full text search (supports & and |), tag search or search for todos ( - [ ] or * [ ]) . It also allows to quickly create new notes based on custom templates. I started to write this to replace the ton of Note taking apps that I used a while ago. I spent a lot of time to get this to work and the setup is a bit complex but once you went thru the steps it can indeed replace your note taking app. The best MD Editor for this purpose is Typora but any other MD editor works as well. Download at Git as usual: https://github.com/Acidham/alfred-markdown-notes/releases/latest
  16. I probably spent far too much time not knowing what I was doing to produce this workflow but now that it will prettify a single obfuscated .json file, I could use some help with improvements: Support prettifying multiple selected files at a time (I've been able to do this with other languages, but haven't figured out how to work with an array of files in python in a Script Filter) Ignore any non-JSON files that might be passed in (currently if you run this against a TXT file, it'll replace the file contents with {query}! (whoops)) Improve the notifications based on whether a single or multiple files were processed I did take a look at @deanishe's Workflow Library or Python but it seemed like overkill for what I wanted to do. Also, I did find several other workflows that will prettify the clipboard's contents, but I specifically want to just handle files in Finder (for now). I found this technique which looked promising, but I kept getting syntax errors in the Script Filter when I would run it: import json import os # Read JSON data from file and pretty print it with open("{query}", "r") as jsonfile: # Convert JSON file to Python Types obj = json.load(jsonfile) # Pretty print JSON data pretty_json = json.dumps(obj, indent=4) print(pretty_json)
  17. 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!!
  18. This is a workflow for easily downloading videos (and/or extracting audio) from various websites such as YouTube, Vimeo, DailyMotion and more... It uses youtube-dl as the core component. Main Features: Download video from URL. vd {video-url} Download and extract audio into an MP3 file. vd-audio {video-url} Display and download video metadata (json). vd-info {video-url} Update core component (youtube-dl). vd-update Display quick help in Large Type. vd-help Note: vd-update command currently only updates youtube-dl, not the workflow itself. Please see full details, updates (and source) of the project at GitHub. Download Video Downloader workflow. Here is a full visual list of what Video Downloader can do: And here is how the workflow nodes look like: Requirements: For the audio extraction (vd-audio) feature to work, you should install FFmpeg yourself manually (because of licensing issues). If you don't have it already; you can find details on how to install FFmpeg at the GitHub page. --- (While writing this, I found out about Vítor's workflow; which is also nice and uses youtube-dl. Well, I'm releasing this anyway for it's extra features like audio conversion, metadata info, etc..) Pls. drop a note if you like it... Thanks.
  19. Hey all! This is a newbie question, thanks in advanced for you patience. I have written a script that restructures a specific URL on python. It works well in Pycharm. I am wondering how I can use alfred to run this script. Happy to do the work of reading and learning, but after hours of googling I have come up mostly empty handed. Code below incase it's relevant. import pyperclip text = pyperclip.paste() link = text pt_1, Pt_2 = link.split("#") notion, erase, delete = ([pt_1[i:i+22] for i in range(0, len(pt_1), 22)]) confirm = ('{}{}'.format(notion, Pt_2)) pyperclip.copy(confirm)
  20. Hi, [Objective] I am trying to build a workflow which gets a DOI link [e.g. https://doi.org/10.1287/orsc.3.3.398] and sets my clipboard to some text from a pulled JSON file. In this case (Orlikowski, 1992). However, I am having a hard time importing the query from Alfred in to the file, and getting it back. I have written the python script, lack the means to use the file. I have made the beginning of the workflow, using regex to focus on the link I need (e.g. 10.1287/orsc.3.3.398) with the regex key - (\/\d{2}.\d{4}\/\w.*), def main(): urlData = "https://api.crossref.org/works/" # the query should be inserted on line 44 urlData += "10.1287/orsc.3.3.398" # Open the URL and read the data webUrl = urllib.request.urlopen(urlData) print ("result code: " + str(webUrl.getcode())) if (webUrl.getcode() == 200): data = webUrl.read() # print out our customized results, but should set this to clipboard print(printResults(data)) else: print ("Received an error from server, cannot retrieve results " + str(webUrl.getcode()))
  21. There is a bug in my (unofficial) Alfred-Workflow library that causes very many workflows using it to hang quite dramatically on Sierra. If you are affected (i.e. you see Alfred's CPU usage spike to 100%), Activity Monitor will show two Python processes like this (choose View > All Processes, Hierarchically), with the bottom one at ~99% CPU (this screenshot is actually of a non-misbehaving workflow): Download and run this workflow, which will update any old versions of Alfred-Workflow in your installed workflows. That should get your workflows working again until the workflow developers can push official fixes.
  22. IMPORTANT NOTE ABOUT HANGING PROCESSES ON SIERRA (2017-04-03) Versions of Alfred-Workflow older than 1.25 cannot launch background processes properly on Sierra. In fact, they regularly hang quite dramatically and consume 100% CPU Users (in particular) affected by this bug should install and run this workflow, which can find and fix any workflows with broken versions of Alfred-Workflow. The workflow library for Python GitHub | Documentation A feature-rich library for developing Alfred workflows in Python The library is simple to install, has no external dependencies, is very well-documented and maintained, and boasts an eye-wateringly high feature-to-size ratio at under 400 KB. It is the only Python library that is always up-to-date with Alfred's features. Main features Supports all Alfred features from 2.0 to 3.6. Catches, logs and notifies users (and developers) of errors in Workflows. No more confusing, silent failure. Super-simple, yet powerful data caching (e.g. from a web service) and storage, including session-scoped data. Easy-to-use Workflow settings API. Supports Alfred's AppleScript API, including saving settings to info.plist and calling External Triggers. Keychain access for secure storage (and cross-machine syncing) of sensitive data, like passwords and API keys. Tunable and understandable Alfred-like fuzzy search (e.g. got matches Game of Thrones as well as Baby Got Back. Or not: that's up to you.) Extremely lightweight, but full-featured, HTTP library with Requests-like interface, but just 12 KB instead of > 2 MB. Convenient access to standard macOS icons, for high-quality, familiar icons without adding size to the library. Also available via proper English. Pre-configured, built-in logging to enable simpler Workflow debugging. Painlessly run (update) scripts in the background without blocking your workflow, so you can still show "old" results while fetching new ones. API for running AppleScript/JXA scripts. Simple support for 3rd-party libraries your Workflow relies on. "Magic" arguments to make developing/debugging Workflows so much easier, especially when helping less technically-inclined users. With "magic" arguments, you and your Workflow's users can open the Workflow's log file in Console.app, its cache and data directories in Finder, and its root directory in Finder or Terminal from the comfort of Alfred's query box. You can also delete the cache/data/settings if something is corrupted. Your workflow can update itself via GitHub releases. Smart handling of non-ASCII. Query sale will match result salé, but query salé will not match result sale. Functions to support migrating settings/data from older versions of your workflow. Alfred 3-only features Workflow variables Advanced modifiers Alfred 3-only updates Re-run Script Filters And as you can see from the above links, there is extensive documentation, including a two-part tutorial on building a Workflow from scratch. Examples Here are a few examples of how you can do some pretty cools stuff in just a few lines of code. A simple Workflow I made to search Packal in ~90 lines of code. A simple Workflow to search your recent Pinboard posts in ~50 lines of code. A polished, user-friendly, wicked-fast Workflow to search your recent Pinboard posts in ~200 lines of code. Remember, each of these Workflows also has—for free—full error-catching and -logging support, and the ability to open its log file (which contains all errors) via Alfred's query box. No need to ask users to grub around in ~/Library or flounder in Terminal here. This is not the Workflow library 2014 deserves, but it's the one it needs Feedback If you have any bug reports/feature requests, add them either here or on GitHub. More info The documentation is the definitive source of information on the Alfred-Workflow library. The User Guide and Tutorial provide fairly extensive information both on how to use Alfred-Workflow and write Workflows in general (if you're new to this lark).
  23. This workflow lets you control your Home Assistant from Alfred. You will be able to control you lights, get sensor information, trigger automations and look for your devices in device tracker. And more to come.. Setup _haurl - Set the URL to the home assistant. _hapassword - set the API password for Home Assistant Commands to interact with home assistant To triggar an automation: haa To control lights: hal To control your alarm: haal To look at a Sensor: has To look at device tracker had You will find the workflow here : https://github.com/Skakiz/Alfred-Home-assistant-workflow Lights: Automations: This is my first python coding, so no glitter code. Thanks! //Andreas
  24. Open man pages with name and section filtering. The 'man' keyword exploits the x-man-page: protocol handler, so will default to opening in Terminal.app but can easily be switched to iTerm2.app. 'hman' opens pages in your default browser, and 'pman' opens PDFs in the default PDF reader. Download / Source Usage man open(1) # open a specific page pman style # open a PDF of the style(9) manpage man open # search all sections for pages matching 'open*' man *open # search all sections for pages matching '*open*' man 2 open # search section 2 for pages with 'open' in the name Enjoy.
  25. Hello,everybody! I want to implement a very simple function by workflow. First, type the keyword as a trigger and a number (for example decimal 23.45678) as a query. Then, convert it to 23.46(keep two decimal places). Finally, copy the consequence to the clipboard. It seems a really easy job. But I don’t know how the query or arguments input and output through python. After searching answers for several hours, I can’t find similar demos from internet. It makes me a little depressed. Could anybody do me a favor? Thanks so much!
×
×
  • Create New...