Jump to content

FroZen_X

Member
  • Posts

    364
  • Joined

  • Last visited

  • Days Won

    17

Reputation Activity

  1. Like
    FroZen_X reacted to Andrew in How to delete Last Clipboard entry   
    @FroZen_X you can delete individual items manually using cmd+backspace in the clipboard history viewer.
     
    If you could set Keyboard Maestro to use a transient marker when populating the clipboard, then Alfred's history will ignore this. Alternatively, you could setup an Alfred workflow to do a similar task, and Alfred's Clipboard output object can set the text as transient.
     
    Cheers,
    Andrew
  2. Like
    FroZen_X reacted to vitor in Opening newest file in a folder   
    You can grab RecentDownloads (disclaimer: I wrote it) and go into the top Script Filter and change the directory listed on the second line of code. Instead of ${HOME}/Downloads, change to whatever your target directory is. That still won’t automatically open the most recent file, but it’ll list everything on that directory with the newest thing on top.
  3. Like
    FroZen_X reacted to Andrew in How to include workflow results in default search   
    @vitor pretty much sums up the reasoning behind this. Essentially, Alfred is extremely lightweight on a user's Mac, having minimal CPU and battery impact at all times. This is essentially achieved by only running the internal logic paths required which lead to the user's desired result at any one time, not running any unnecessary code. This becomes more significant when [non-native] workflows may take a decent amount of CPU or network traffic.
     
    Added to the fact that this is a rarely requested feature, it's unlikely that this will be implemented into Alfred's default results.
     
    Having said that, and having a think about this, there is one aspect I would consider. You can already create a workflow and attach it to an input filter (such as a file filter, script filter etc). At this point, it's a 1 to 1 mapping for hotkey to input filter. If there was interest, I'd look at enhancing this so that one hotkey could connect to multiple input filters, and results from all filters would be shown. This would essentially allow you to build a workflow which shows a custom version of Alfred with the specific, highly customised results you'd like.
     
    Cheers,
    Andrew
  4. Like
    FroZen_X reacted to deanishe in How to include workflow results in default search   
    Connecting a Hotkey to multiple inputs isn't a bad idea, but it would make more sense, imo, to implement multiple inputs at a lower level, ideally allowing workflows to fetch results (or better yet, arbitrary data) from other workflows.
     
    At the very least, combined inputs should work with a keyword, too.
     
  5. Like
    FroZen_X reacted to vitor in Can't disable "Show list of available Actions for selected Finder item" hotkey?   
    Alfred Preferences → File Search → Actions → File Selection.
  6. Like
    FroZen_X reacted to Andrew in Using selected text as input, possible?   
    @Overload119 The easiest way to achieve this at a generic level is to have a single separate hotkey defined to show Alfred with the currently selected text in macOS, and place the cursor to the left.
     
    i.e. my Alfred hotkey is alt+space, but I have ctrl+alt+space (workflow hotkey trigger by itself) setup as the following, which puts Alfred in a state (cursor to the left) ready for me to type the keyword:
     

     
    This way, you only need to remember two hotkeys - One for Alfred by default, and one for Alfred with selected text.
     
    Cheers,
    Andrew
  7. Like
    FroZen_X reacted to dfay in Sharing Workflows I use as a Mind Map   
    I used Gemini 2 a lot about a year ago when I replaced the mechanical HD on my iMac with an SSD and 2nd HD, and cleaned up several hundred GB of photos in the process.  It worked fine for me but I switched to using SnapSelect for photos since it does fuzzy matching of similar but not identical photos.  No complaints with Gemini 2, though.  The bigger trick is to set up your work process so you don't end up with dupes in the first place
  8. Like
    FroZen_X reacted to vitor in Sharing Workflows I use as a Mind Map   
    Used to do it with duff but currently use rmlint. The latter also has a GUI, but I’ve never used it.
  9. Like
    FroZen_X reacted to nikivi in Sharing Workflows I use as a Mind Map   
    I have recently updated my github repository with quite a few workflows that I use added to it. I still have quite a few to add and will update it with time but there is still quite a bit there I think. All the ones that have ✨ next to them are ones I heavily use and recommend. Each of the links is clickable too. And here it is as a live mind map.
     
    It is part of my bigger mind map where I try to document my knowledge and curations in an open and easily discoverable way. I will also add descriptions to each of the workflows and add gifs where appropriate to get a better idea of what each of the workflows can do.
     
    Hope it would be useful to some.
  10. Like
    FroZen_X reacted to Andrew in how to use "in" with file filter   
    @Srisri You'll need to configure the search fields for the filter to look at text content. Select the Advanced tab of the file filter config sheet and from the + button, select kMDItemTextContent. Remove the other items so it looks like the following:
     

     
    Then, just use the file filter's keyword and search terms.
     
    Hope this helps!
     
    Cheers,
    Andrew
  11. Like
    FroZen_X got a reaction from joeynotjoe in Alfred Regex to extract just the filename?   
    This site might help you like it helped me: http://regexr.com/
    I use it to test Regex and it has good explanations.
  12. Like
    FroZen_X got a reaction from nikivi in What do you map your Alfred Trigger to?   
    Mine is/was mapped to Capslock. I used karabiner which is currently broken under Sierra. For now I'm using a workaround with 
    Keyboard Maestro tho ^^
    When karabiner works again, I will actually move that to another combo as I want to use my Capslock as a hyper key. Let's see  
  13. Like
    FroZen_X reacted to daftmilk in Going postal: copy contact with name and address   
    What does it do?

    Search Contacts.app for named contact and copy full postal address (including name and company) to clipboard.
    Usage

    Open Alfred.
    Type postal <Some name>.
    Use arrow keys to browse results.
    Hit enter to copy postal address to clipboard.
    CMD + V to insert address wherever.
    Download

    Going postal.alfredworkflow
  14. Like
    FroZen_X reacted to deanishe in Can I apply text formatting to Notes via Alfred?   
    You don't need Alfred for this. It's built in to OS X.
  15. Like
    FroZen_X reacted to deanishe in Handling workflow/environment variables   
    This is something I'm considering adding to Alfred-Workflow, kinda like an HTTP session. Version 2 is going to be a straight port of the v1 API to Alfred 3 (although it's very different internally), but I hope to add something more useful to v3 once we've all figured out the best way to work with Alfred 3.
    When Andrew adds internal triggers, it might be possible to build quite a powerful API on top of them.
  16. Like
    FroZen_X reacted to deanishe in Handling 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.

     
  17. Like
    FroZen_X got a reaction from deanishe in Splitting a query into two variables   
    Have you changed something since we've talked about it? 
    Nevertheless i can now access environment vars in applescript via this:
    set x to (system attribute "filename") That would be a set "{var:filename}"
     
    Awesome that this works now tho! Or that i know this now haha, no workaround anymore
  18. Like
    FroZen_X got a reaction from adamp64 in How do I hide .prefPane from search results?   
    U can just choose appstore a few times and Alfred should learn which you actually start everytime and therefore pop up further up in the list.
    Other than that you can open spotlight settings → privacy → search with Alfred for the prefpane and drag drop it there. After that it shouldn't appear in Alfred anymore. If it still doesn't then delete it → wait a moment and redo it, else you gotta have to reindex.
     
    Hope this helps
  19. Like
    FroZen_X got a reaction from fredcallaway in Transparency while dragging a file   
    +1 That's a feature i wanted to suggest too haha, would we awesome if Alfred hides for the moment as its sometimes in the way. 
    I could move the window to the top right or so....but i don't want to
  20. Like
    FroZen_X reacted to Andrew in Autoexpand in Note App creates newline   
    Hah interesting! I'll pass that info on to Vero - it might be a good one for our knowledge base thanks!
  21. Like
    FroZen_X got a reaction from robintw in Shortcut to copy path to clipboard   
    Keep in mind that you can also create your own actions and run scripts etc. right away instead of doing multiple actions
    Click the "+" in workflows → Getting Started → File Actions
  22. Thanks
    FroZen_X got a reaction from blizzrdof77 in Shortcut to copy path to clipboard   
    You can just select the File/Folder you found and press Cmd+C and it will copy the path with file to your clipboard. 
     
    To kinda sort your actions by usage, go to Alfred preferences → File search → Actions → and check Action Ordering.
    There you can also deselect some actions you don't need. 
     
    Hope that helps
  23. Like
    FroZen_X reacted to Andrew in Using workflow variables in Run Script actions   
    I've been trying to work out why osascript doesn't respect the passed in environment through NSTask like the others do, it seems to be a bug with osascript, but I'll keep working at it!
  24. Like
    FroZen_X got a reaction from jyoshimi in Searching using path   
    Here is the example:
     

     
    And thats under Alfred 3
  25. Like
    FroZen_X got a reaction from TimesReader in Evernote Workflow 9 beta 4 (Alfred 4)   
    Here is a temporary fix.
    Go to: /Users/YOURUSERNAME/Library/Application Support/
     
    And there you paster the file of this zip: https://www.dropbox.com/s/xqchp9uzhfbvtg9/Evernote%20Workflow%20fix.zip?dl=0
     
    Its the old Alfred 2 file its asking for. Somehow the app doesn't update for some. It did for me in the first case and then never again lol
    I'll see if i find another solution, but this one works for now.
×
×
  • Create New...