Jump to content

juliosecco

Member
  • Content Count

    114
  • Joined

  • Last visited

  • Days Won

    3

Reputation Activity

  1. Like
    juliosecco reacted to dfay in Fuzzy, self-updating list filter workflow template   
    # fuzzylist
    Fuzzy, self-updating list filter workflow for Alfred 3
    This is a workflow template - it does nothing as is.
     
    ## Usage:
    - create a csv file like you would for an Alfred List Filter
    - name the file *list.csv* and add it to the workflow directory
    On the initial run, the workflow will create a file list.json for output to the fuzzy search.  If list.csv is modified, it will update list.json .  
     
    ## Credits
    - uses fuzzy.py by @deanishe - https://github.com/deanishe/alfred-fuzzy
     
    ## Download
     
    workflow at https://github.com/derickfay/fuzzylist/blob/master/Fuzzy List Filter.alfredworkflow
  2. Like
    juliosecco got a reaction from MarcG in [SOLVED] Screenshots to preview. Is this possible?   
    just for curiosity and trying to understand,
     
    could you try this?
     
    snapshot2
     
     
     
  3. Like
    juliosecco reacted to vitor in [SOLVED] Screenshots to preview. Is this possible?   
    screencapture, which comes with macOS, is surprisingly capable (man screencapture) and can do it in a single command:
    screencapture -iP "$(mktemp).png" i is to capture interactively (i.e., the same as ⌘⇧4). P is to open the image in Preview after it’s done. "$(mktemp).png" is a temporary file to store the screenshot, which screencapture needs.  
    Add that in a Run Script Action connect by a Hotkey Trigger, and you’re set. Here’s a ready-made Workflow.
  4. Thanks
    juliosecco reacted to isaacpz in Word Search: A workflow to make you a better writer   
    Word Search is an Alfred 2/3 workflow which exposes powerful word searching utilities. Ultimately, the workflow can be leveraged to widen your vocabulary and make you a better writer.
    Quick Reference
    syn [word] - Broadly searches for words related to a word/phrase. dsyn [word] - Searches for a word’s exact synonyms. ant [word] - Searches for a word’s antonyms. rhyme [word] - Searches a word’s rhymes. describing [word] - Searches for words that describe another word Usage
    Simply type in a command. Selecting a result will copy that word to your clipboard and automatically paste it in the front most app.
    Installation
    Simply download the latest .alfredworkflow file and double click it to import it to Alfred. Word Search will update on its own.
    Demonstration
    Searching for words that describe “dog” 

     
    This forum doesn't like many images. If you want to see more screenshots, checkout the github page.
  5. Like
    juliosecco reacted to Carlos-Sz in Recent Items 4.3 beta 2 for Alfred 4: Finder Recent Items   
    Overview

    Workflow to display recent Finder files and folders featuring:
    5 default categories 2 custom categories Favorites, including a file action Keywords and hotkeys for Favorites and all categories apart Interaction with Open/Save dialogs and Finder Go To Folder Preview, reveal, open or use Alfred file actions Usage

    Show Alfred and type the keyword rec:



    You can also use the category keyword if you prefer to access the recent files directly, without an initial menu:
    Now: keyword now Folders: keyword fol Applications: keyword apps Documents: keyword docs Downloads: keyword dow Custom Category 1: keyword c1 Custom Category 2: keyword c2 Favorites: keyword fav In addition, there is a hotkey for the keyword rec, Favorites and all categories apart.

    Note that all keywords, as well as the hotkeys, can be changed (go to Alfred Preferences > Workflows).

    Finally, once inside a category you have the following actions:
    Return key: open the file or folder Command key: reveal the file or folder in Finder Option key: pass the file/older path to an open/save dialog or Finder window Control key: add/remove an item to/from Favorites Shift key: preview (Quick Look) the file or folder Custom Categories

    You can set up to two custom categories:
    Show Alfred and type the keyword recpref Select a category to configure and press return key Type an unique category name with at least 3 characters Type one or more (separated by comma) file types e.g.: com.adobe.pdf,public.plain-text To find a file type you can use Alfred Metadata Analyzer.

    To remove a custom category press command key while highlighting one of them in recpref.

    Favorites

    All files or folders set as a favorite item will remain in the list no matter how old they are.

    To add an item to Favorites just highlight a file or folder, hold control key and press return key.

    To remove an item go to Favorites, highlight an item, hold control key and press return key.

    You can also add items utilizing Alfred File Action (accepts multiple files).

    Note that Favorites has also its own keyword (fav) and hotkey.

    Interacting with Open/Save Dialog or Finder

    You can pass a recent file or folder path, or an item in Favorites, to an open/save dialog or even the current Finder window to go to that folder:
    when an open/save dialog is displayed type the keyword rec or any other category keyword find an item (a file or folder or an item from Favorites), highlight it, hold option key and press return key wait a bit so the workflow can load and paste the item path Default Folder

    The workflow remembers the last path used per application. To use the feature just type the keyword df when an open/save dialog is displayed.

    If the workflow was never used for the application, or the path does not exist anymore, then the keyword rec will be automatically triggered so you can select a path from a file or folder.

    There is also a hotkey to make things even faster.

    Make sure to give the feature time to process because e.g. if you hold keyboard keys way too long then the feature may not work as expected.

    What’s new
    Up to 2 custom categories (keyword recpref) Downloads category Keyword for each category Hotkey for each category Multiple files in Add to Favorites file action Changed Auto-path to Default Folder (keyworod df) Changed Just Now category to Now Added Help (keyword rechelp) Update to Alfred 2.3 features Several internal improvements  
    Download
     
    Version 4.3 beta 2 (removed Alfred 3 references) Release date: 12 Jul 2020 Requires Alfred 4 Download  
    Version 4.2 Release date: 19 Jun 2016 Requires Alfred 3 Download  
  6. Like
    juliosecco got a reaction from Empyreal in Alfred snippets with trailing space or tab.   
    OK,
    please forgive me,
    but you know, I'm italian,
    and some kind of a respectful chatting is in my DNA,
     
    I'll shut up now  
  7. Like
    juliosecco got a reaction from Empyreal in Alfred snippets with trailing space or tab.   
    well, at least a little sign of  appreciation...
     
    In have seen Vero and Andrew answering you like two little Gandhi...
     
    please, try to be 'amazing' a little you too, just some little 'thanks' or 'regards' or 'cheers' or 'hi' or 'thanks' while you are posting your questions would be appreciated ( from me at least, but maybe I'm  too much sentimental )
     
        Giulio
  8. Like
    juliosecco reacted to deanishe in [PYTHON FIX] How to fix Python workflows hanging Alfred on Sierra   
    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.
     
  9. Like
    juliosecco got a reaction from deanishe in [HOW TO] Workflow/environment variables   
    Hi,
    I would like to share a thing I just discovered about environment variables and php:
     
    today I have changed my php.ini.default in php.ini to test a workflow with a 'developer' php warning level, and I was not more able to read environment variables using $_ENV['name'].
    I have discovered that in the php.ini there was a directive variables_order, its comment is:
     
    " This directive determines which super global arrays are registered when PHP starts up ... There is a performance penalty paid for the registration of these arrays and because ENV is not as commonly used as the others, ENV is not recommended on productions servers. Yo can still get access to the environment variables through getenv() should you need to."
     
    it was set to "GPCS" where the letters mean GET, POST, COOKIE, ENV and SERVER, and in its default value the E for ENV was missing, for that the $_ENV was not working anymore.
     
    Setting it to  "GPCSE" made everything work again, but what I have learned is that using $_ENV and getenv() is not equivalent, being the latter better to be sure to correctly read the variable with every php.ini setting, so from now I will always use getenv().
     
    hope this helps,
     
        Giulio
  10. Like
    juliosecco reacted to ramiro.araujo in Transmit 4 Favorites Workflow, FAST   
    Transmit 4 Workflow for Alfred app
    Workflow for searching and opening Favorites in Transmit 4 App. It's really fast, because it reads the SQLite Database or XML datasource in latests releases of Transmit 4.
    There are already at least 2 Transmit workflows, but one is incompatible with latests Transmit 4 and the other, although very good, uses AppleScript to do the searching, and thus you need to wait for Transmit to open to get feedback. This is particulary slow on non SSD machines.
     
    Usage
    Type the keyword (default ftp) and start typing the name of the favorite to search; dead simple.

     
    Installation
    For OS X 10.9 Mavericks, Download the alfred-transmit.alfredworkflow and import to Alfred 2.
    For Previous OS X Versions, Download the alfred-transmit.alfredworkflow and import to Alfred 2.
     
    Source Code
    Clone or Fork the Workflow: https://github.com/ramiroaraujo/alfred-transmit-workflow
     
    Changelog
    2013-12-16 - Released 2014-01-02 - Added support for previous OS versions, using System Ruby 1.8, tested up to Lion 2014-01-03 - Search in both Favorite name and host 2014-01-20 - Added support for Favorites.xml 2014-01-30 - Rebuilt XML search to use different Ruby xml parser Note: I updated the original description to match the project readme file
  11. Like
    juliosecco reacted to deanishe in Multilingual translation dictionary with Glosbe.com   
    Translate between hundreds of languages with Glosbe.com.
     

    By default, the workflow is set up to translate between German and English:
    .ende English query — show German translations of English query. .deen German query — show English translations of German query. ENTER — copy selected translation to the clipboard. CMD+ENTER — open translation in browser. glosbehelp — open the included help file in your browser. glosbelang [query] — view and search supported languages. To use other language pairs, you will have to edit the workflow, either changing the included English <-> German Script Filters or adding your own using them as a template.  
    For more information and to download the workflow, see the Packal page or grab it from GitHub.
  12. Like
    juliosecco reacted to Sampayo in Switch Between audio input and output   
    Audio Switch
    ==================================================================================
     
    Switch between your input sources and output devices.
     
    To install just download (or my github) and doble click the .alfredworkflow file.*
     
    To change your input source type input (it could take a little bit to load your sources), then select the one you desire
     

     
    The same for the output device, just type output then select your choice
     

     
    Since I don't have any audio device or source connected to my laptop only 1 (the default) device and source are shown.
  13. Like
    juliosecco reacted to deanishe in [HOW TO] Workflow/environment variables   
    Note: This post is out of date as of Alfred 3.6 (which introduced AppleScript functions to set and remove variables).

    There is an updated version on my own site: Workflow/environment variables in Alfred.

    This post will not be updated due to the difficulty of editing complex posts using the forum software. Sorry.
     
     
    This is a brief look at how to get, set and save variables in code (i.e. in Script Filters, Run Script Actions, etc.).

    In Alfred 2, you had one single variable to work with: the {query} macro. Alfred 3 adds the ability to specify as many variables as you want. Alfred's own help provides a great description of working with variables in Alfred's own UI. I'm going to look more closely about getting and setting workflow/environment variables in your own code within a workflow.

    First of all, it bears mentioning that all variables are strings. Sure, you can set a variable to a number in JSON, but when it reaches your next script or one of Alfred's Filter Utilities, it will be a string. If you set a variable to an array (e.g. [1, 2, 3, "mach dat Mäh mal ei"]), Alfred will turn it into a single, tab-delimited string ("1\t2\t3\tmach dat Mäh mal ei").

    Setting variables

    There are several ways to set variables. The most obvious ones are in the Workflow Environment Variables table in the workflow configuration sheet and using the Arg and Vars Utility. The configuration sheet is largely without magic, but in an Args and Vars Utility, you can use variable expansion macros: {query} expands (as always) to the input (which may be a user-entered query or the output from a previous Action), and you can use {var:VARIABLE_NAME} macros for your own custom variables.  This is described in detail in the above-mentioned help pages.

    More interestingly, you can also set variables via the output of your scripts (i.e. dynamically) by emitting appropriate JSON. How you set variables depends on whether you are using a Script Filter or a Run Script action.

    You must use the appropriate mechanism, or it won't work.

    From Run Script actions

    Let's say your script outputs a URL, e.g. https://www.google.com. Normally you just do print('https://www.google.com') (or echo or puts) and that gets passed as the input to the next action. To also pass variables, you instead emit JSON in a very specific format:
    {"alfredworkflow": {     "arg": "https://www.google.com",     "variables": {"browser": "Google Chrome"}}} The root alfredworkflow object is required. If it's missing, Alfred won't parse the JSON, but will pass it as-is as input to the next action (which can also be very useful). Your output (i.e. the next Action's input/{query}) goes in arg, and any variables you wish to set go in the variables object.

    From Script Filters

    You can also set workflow variables via Script Filter feedback at three different levels: the root level, the item level and the modifier level. (Note: This only applies to JSON feedback; XML feedback is now deprecated and does not support the features described here.)

    In each case, variables are set via a variables object at the appropriate level (feedback root, item or mod).

    Root-level variables

    Root-level variables are always passed to downstream elements regardless of which item is actioned. They are also passed back to the same Script Filter if you've set rerun, so you can use root-level variables to implement a progress bar.

    browser is set to Safari for all items:
    {"variables": {"browser": "Safari"},  "items": [{"title": "Google",    "arg": "https://www.google.com"}]}
    Item-level variables

    Item-level variables are only passed downstream when the item they're set on is actioned, and they override root-level variables. Root-level variables are also passed downstream when you action an item.

    browser is set to Safari by default, but Google Chrome for Reddit:
    {"variables": {"browser": "Safari"},  "items": [    {"title": "Google",      "arg": "https://www.google.com"},    {"title": "Reddit",      "arg": "https://reddit.com",      "variables": {"browser": "Google Chrome"}}]}
    Modifier-level variables

    Modifier-level variables are only passed downstream when the corresponding item is actioned with the appropriate modifier key pressed. They replace item- and root-level variables (i.e. if a modifier sets any variables, Alfred ignores any root- and item-level variables).

    As above, browser is set to Safari by default and Google Chrome for Reddit. But you can also pass browser=Google Chrome for Google by holding ⌘ when actioning it:
    {"variables": {"browser": "Safari"},  "items": [    {"title": "Google",      "arg": "https://www.google.com",      "mods" {"cmd": {"variables": {"browser": "Google Chrome"}}}},    {"title": "Reddit",      "arg": "https://reddit.com",      "variables": {"browser": "Google Chrome"}}]}
    Using variables

    So you've set a few variables, and now you want to use them. Within Alfred elements like Arg and Vars or Filter Utilities, you use the above-mentioned {var:VARIABLE_NAME} macros. Very simple.

    Where it gets a little more complicated is in your own code. First and foremost, {var:VARIABLE_NAME} macro expansion does not work in Run Script Actions (or Run NSAppleScript).

    When Alfred runs your code, it does not use {var:...} macros, but rather takes any workflow variables and sets them as environment variables for your script. Using the above example again, Alfred would pass "https://www.google.com" to my script as input (either via ARGV or {query} depending on the settings) and it would set the environment variable browser to Safari or Google Chrome. How you retrieve environment variables depends on the language you're using.

    Accessing environment variables in different languages

    In bash/zsh, the variables are already in the global namespace. Just use $browser

    In Python, use the os.environ dictionary or os.getenv('VARIABLE_NAME'):
    import os browser = os.environ['browser'] # Or browser = os.getenv('browser')
    In AppleScript, use system attribute:
    set theBrowser to (system attribute "browser")
    In JavaScript (JXA), use $.getenv():
    ObjC.import('stdlib') var browser = $.getenv('browser')
    In PHP, use getenv():

    (Please see this comment by juliosecco on why you should use getenv() over $_ENV.)
    $browser = getenv('browser'); // Or $browser = $_ENV['browser'];
    In Ruby, use ENV:
    browser = ENV["browser"]
    Saving variables
     
    NOTE: This section is out of date as of Alfred 3.6. Please see the updated version linked at the top of the post.
     
    As amoose136 points out, any variables you set in a running workflow are not saved. They exist as long as the workflow is running and then disappear. Any Workflow Environment Variables will "reset" to their values in the workflow configuration sheet on the next run.

    Generally, this is what you want, but sometimes you want to save a variable's value. For example, you might have an API_KEY Workflow Environment Variable in the configuration sheet. The user can enter their API key for the service in the configuration sheet, but you'd also like to add the ability to set it from within your workflow, e.g. with a setapikey Keyword and corresponding Run Script action.

    WARNING: As of Alfred 3.4.1, Alfred takes several seconds to notice when info.plist has been updated by something other than itself. As a result, relying on altering info.plist programatically can be problematic, as Alfred won't notice the changes for several seconds (5–10 seconds is typical on my machine). If you update a workflow variable in info.plist and run your workflow again immediately, it is unlikely that Alfred will have picked up the change.

    The Workflow Environment Variables are contained in the variables section of info.plist. Consequently, to update them, you need to update info.plist.

    Regardless of which language you're using, you can call the PlistBuddy program to alter Workflow Environment Variables:
    # Set a variable /usr/libexec/PlistBuddy -c "Set :variables:API_KEY \"ABC-XYZ\"" info.plist # Delete a variable (i.e. remove it entirely from Workflow Environment Variables) /usr/libexec/PlistBuddy -c "Delete :variables:API_KEY" info.plist
    In Python, there's no need to use an external program, as it has the built-in plistlib library:
    from plistlib import readPlist, writePlist # Read info.plist into a standard Python dictionary info = readPlist('info.plist') # Set a variable info['variables']['API_KEY'] = 'ABC-XYZ' # Delete a variable del info['variables']['API_KEY'] # Save changes writePlist(info, 'info.plist')
    (Note: plistlib only works with XML property lists, which is fine for info.plist, but using PlistBuddy is generally more robust.)

    Don't forget: any changes you make to info.plist only take effect the next time the workflow is run. This likely doesn't matter in most cases, but if you need a variable to be updated immediately (i.e. also for the current workflow run), you must also set it "live" using one of the methods described in the Setting variables section above.

     
  14. Like
    juliosecco got a reaction from deanishe in Alfred snippets with trailing space or tab.   
    OK,
    please forgive me,
    but you know, I'm italian,
    and some kind of a respectful chatting is in my DNA,
     
    I'll shut up now  
  15. Like
    juliosecco got a reaction from deanishe in Alfred snippets with trailing space or tab.   
    well, at least a little sign of  appreciation...
     
    In have seen Vero and Andrew answering you like two little Gandhi...
     
    please, try to be 'amazing' a little you too, just some little 'thanks' or 'regards' or 'cheers' or 'hi' or 'thanks' while you are posting your questions would be appreciated ( from me at least, but maybe I'm  too much sentimental )
     
        Giulio
×
×
  • Create New...