Jump to content


Popular Content

Showing content with the highest reputation since 11/07/2019 in Posts

  1. 5 points

    Calculate Anything

    Calculate Anything is a workflow for Alfred 4, that uses natural language and is able to calculate multiple things like currency, time, vat, percentage, etc. Why? There are several workflows out there but i just needed a workflow that worked naturally for example you can open alfred and type 100 + 9 and alfred will give you a result no need for keywords or hotkeys it just works, i wanted to be able to jus type 100 + 16% or 100 euros to usd or 100km to cm or 100 years to hours and a large etc. and so this workflow was created. Features - Natural language - type 100 euros to dollars or 100 euros in usd or 100€ to $ or 100eur usd or 100 euros a dolares. It does not matter, the same result will be displayed. - Currency - Up to 168 currencies - Units - 100 kilometers to meters or 100km to m or maybe 100km m - Percentages - 100 + 16% | 100 - 16% etc. - PX,Em,Rem,Pt - 12px or 12px to em or 12px pt - Time - time +15 years? now plus 15 hours? or need to convert a timestamp? - VAT - value added tax calculations, we all need this - Translations You can create your own translations to display results in your language - Keywords Extend the natural language in the queries so you can type 100 dolares a pesos and the code will see 100usd to mxn Download Download directly from Github releases page, make sure to download the latest release. Download here Base Configuration There's only one global configuration and is the language, this configuration will be used to display the messages in your own language. View the Translations secction for the available languaes. Configure it with. calculate configure and select Set base language and enter the language for example es_ES For more information about configuration click here Currency You can use natural language or type a few characters and that's all, for example: 100 usd to mxn 100$ in mxn 100€ to $ 100 euros to dollars 100 euros a dolares (you can also write it in your own language) 100eur (If no target the currency will be converted to the base currency that you configured) All this examples will simply work, you can add spaces between the value and the currency or don't. If by any chance you don't remember the currency symbol or abbreviation simply type calculate list and select "List Available Currencies" (view the gift above) Currency Options By default the workflow will use exchangerates api to make the conversion, exchangerates has only support for 32 currencies, if you need support for all the currencies that this worflow includes you need to get a FREE API Key from https://fixer.io it takes less than a minute. The following options are available for the currency. Simply launch Alfred and type calculate configure and select any of the options below. View the configuration section for more info Set base currency This will become your base currency, if you type 100eur it will automatically be converted to mxn, examples of currency (USD, EUR, MXN, CAD, etc) Set currency locale Used to give format to the converted amount using the money format of your contry Set Fixer API Set your fixer API Key for support more currencies Currency Symbols You can also use currency symbols in your query for example 100¥ to € will be converted to 100JPY to EUR, here is a list of available symbols. Please go to the repo description on Github for a full list of supported symbols it's really difficult to write them here in the forum. View Currency Symbols Units You can write your query using natural language or just a few characters, either way this workflow will give you the result you need. 100 ounces to kilograms 100oz to kg 100oz = kg 100oz kg 10 years to months 10years to seconds 1 year to sec 1hr s 10 días a horas (use your own language) If you don't remember the unit abbreviation just simply type the name for example instead of "oz" you can type "ounce" or "ounces" or even use words in your own language for exaple "onza" or "onzas" in spanish. Finally if you still don't remember the unit abbreviation or it's name simply type calculate list and select "List Available Units" you can type to filter, etc. Please go to the repo description on Github for a full list of units it's really difficult to write them here in the forum. View Units Units Options The following options are available. Simply launch Alfred and type calculate configure and select any of the options below. View the configuration section for more info Set System of Measurement Here you can define your System of Measurement, this option is still in development but as the workflow grows this might be necessary for US users, by default the metric system will be used but you can define imperial or metric Percentages You can easily calculate percentages for example: 15% of 50 = 7.50 //7.5 equals to 15% of 50 120 + 30% = 156 //120 plus the 30% of 120 120 plus 30% = 156 //120 plus the 30% of 120 120 - 30% = 84 //120 minus the 30% of 120 120 minus 30% = 84 //120 minus the 30% of 120 30 % 40 = 75% // 30 is 75% of 40. Translations and natural language can also be used 120 más 30% = 156 Time Time is triggered by a keyword because is not often used so you can simply open alfred and type time Gives you the current time time Converts the timestamp to a regular date time 1577836800 Gives you the time from now plus anything you want time +15 days time now plus 3 days Number of days until specified date time days until 31 december The start date of current year time start of year The start date of specified year time start of 2021 The end date of current year time end of year The end date of specified year time end of 2021 It also works in your language time inicio de 2020 time fin de 2020 time dias hasta 31 diciembre Get information about date time 31 December, 2021 18:00:00 time 31/12/2021 18:00:00 time 12/31/2021 18:00:00 Calculate the difference between two dates time 25 December, 2021 - 31 December, 2021 time 31-11-2019 - 21-11-2019 time 11/31/2019 - 11/21/2019 Time Options The following options are available. Simply launch Alfred and type calculate configure and select any of the options below. View the configuration section for more info Set base timezone Base time zone to calculate dates in your time for example (America/Los_Angeles, Mexico/General, etc.) Add date format Configure a new date format so the date is displayed the way you want for example (j F, Y, g:i:s a) Delete date format It will show you a list of configured date formats, simply select the one you want to delete and press enter to remove it Time will use the language that you configure with Set base language VAT (value added tax) With this you can calculate the vat of a given amount. Like time, vat is also triggered with the keyword "vat" you can change the keyword in the workflow. Given the following query vat of 400 (with 16% vat configured, you can configure your own percentage) You will get VAT of 400 = 64 // VAT Amount 400 plus VAT = 464 // Amount plus vat 400 minus VAT = 344.82 // Amount minus vat VAT Options The following options are available. Simply launch Alfred and type calculate configure and select any of the options below. View the configuration section for more info Set VAT percentage for example (16%) Configuration You can easily configure the workflow simply by opening Alfred and typing calculate configure you will see a list of all the available options to configure the workflow, select the option you want and press enter then simply enter your value and again press enter to save it. Check the following gif if you have doubts. Translations Please check the available languages on Github, it's easier to update the information there and also how you can create a translation. Keywords Keywords are words that can be used when writing a query in natural language for example a keyword "ounces" will be converted to "oz", "kilometers" will be converted to "km" or "dollars" will be converted to "USD", "seconds" will become "s" and a large etc. This keywords allows the user to type in a more natural way and in their own language. You can write your own keywords to extend the functionality, please check the information on Github. Stop Words Stop words are words that can be used in the query when using natural language for example "100km to cm" - here the stop word is "to" Stop words are useful for two things: Allows the user to write more naturally and in their own language (e.g 100 dolares a mxn) "a" is the stop word Are used to check if the query has to be processed for example: 100km equals meters if the word "equals" is not registered in the stop_words array then it won't be processed. At the end this stop words are removed so 100km to cm becomes 100km cm. Please take a look at the readme on Github to learn more about this. For Currency, Percentages and Units this workflow will only process the query if it begins with a digit and it has at least 3 characters. Time and VAT have a keyword because those are not often used. Updates Updates are installed automatically when a new version is released you don't have to do anything but if want you can check for new updates manually just launch Alfred and type calculate update the workflow will check for updates and it will let you now if there are any updates available. Lastly This is the first workflow that I create I just had 3 days to do it and 1 was for finding, naming flags, creating translations, creating the readme and this post. If you find a bug or you think this workflow can be improved please let me know or if I created/configured/exported the workflow incorrectly please let me know and I'll fix it. I just purchased Alfred Powerpack and had a great time creating this workflow and I hope that someone finds it useful apart from my lovely wife.
  2. 3 points
    @dfay, @vitor & @deanishe - Thanks for taking the time out to help a coding neophyte, like myself. I really appreciate it. Honestly, I can't thank you guys enough. Alfred's great, but it wouldn't be the first thing I'd install on a Mac, if it weren't for you guys and others on the forum. I've learned a ton from you guys! For others who may be struggling with script filters and JSON outputs, I've uploaded a new version of the workflow to use as a learning example: Download Workflow. The workflow combines everyone's suggestions from above: AppleScript, JavaScript & Ruby. All three are nearly identical, with the exception that the JavaScript and Ruby versions lack the prefix "Same Words" in the subtitle. This should be enough to get you started, if you're also struggling to get your head around how script filters' outputs work.
  3. 2 points
    Thanks Vitor!! This is the very first Alfred Workflow I have downloaded and used, and it works great!! I am very, very, very new to Alfred and all things having to do with running commands in terminal and workflows using Alfred, etc... I feel like I have opened up a whole new world of fun stuff to learn and use with my computer (Mac) and have you to thank. I remember in 4th grade when I first was taught basic Algebra (2 - x = 5) and I was blown away at this new way to solve a problem, and felt so excited about Math and this fun new way to think. Unfortunately I went a different way in my life then was good for me - and only now at 45 years old do I have the motivation to learn something new. After using these workflows and learning about commands in terminal, etc.. I feel just like that kid in 4th grade, with my mind open and am looking forward to this new journey. Thank you so much! iMan
  4. 2 points
    Welcome @Terminal, You can do this with a Workflow. Connect a Hotkey Trigger to a Copy to Clipboard Output. On the Hotkey Trigger, set Argument to Selection in macOS; on the Copy to Clipboard Output, check Automatically paste to frontmost app and on the text box write: {clipboard} {query} Here’s a ready-made Workflow.
  5. 2 points

    Duplicate apps in results (10.15 and V4)

    @MVR London Did you type "reload" into Alfred? This will refresh the app cache for any apps that may no longer exist in the old location. Cheers, Vero
  6. 1 point
    I have been using this command on mac: open -a "Google Chrome" --args --profile-directory="Profile 1" It works for me.
  7. 1 point

    File search is hanging

    After updating to the prerelease, the issue is fixed! Thank you very much for your attention to this issue. Please let me know if there's anything else that I can do to help test. I ❤️Alfred.
  8. 1 point
    That's normal, tbh. It's insane. It'd probably be a better use of your time trying to re-implement your workflow in a sensible language (if that's possible) than muddling through with AppleScript. It's so crazy, I still don't really understand it after using it for years.
  9. 1 point
    @vitor Thanks a ton for the explanation and the two working examples. This was extremely helpful, and it got me thinking that I could probably figure out a way to use my existing AppleScript to generate the list and then feed it into your JavaScript or Ruby script filter examples? It's a pretty complicated AppleScript - for my scripting ability, anyways - that generates the list. To be sure, I don't disagree with any of your statements - or others' on this forum - about AppleScript's 💩 status. But it would take me ages to learn one of these better languages, and then reverse engineer the existing AppleScript. As you can tell, I hardly understand AppleScript 😉 @dfay Thanks for the sources above! One of the first failed variations that I mentioned above came from my hackneyed attempts at pulling out pieces of your windows workflow (the one that works for Preview and a few others apps). When @deanishe mentioned a json.scpt file, I knew that I had seen one in your workflow, so I used it in several iterations. But I could never get any of them to work. However, I completely forgot about your more streamlined workflows for only Preview and Finder. In the multi-app version, I think stringing all those variables together for the different apps got me a little turned around. In any case, I'll go back and take a look at those other versions. Thanks a ton!! I can't thank you both enough!!
  10. 1 point
    The fact that you’re using AppleScript makes the task significantly harder. AppleScript is an awful language: it’s too different from other languages, lacks several features, and is badly documented. That in turn makes it that few people want to use it, meaning there’s less people to help you and less people making resources for you to learn from. AppleScript falls flat on its goal of being a language for people who don’t know how to program. It’s sole redeeming quality is that it can talk to GUI apps in a programatic way built into the system. But I advise you to use it for that alone, and get out and use something else as soon as possible. If you want to learn to program, do not start with AppleScript. It’s weighing you down. At the very least, as @deanishe mentioned in the thread you linked to, use JXA (JavaScript for Automation), which gives you the only good part of AppleScript in a better (yet still not good) language. AppleScript doesn’t understand JSON, you have to build it by hand and that’s not a good situation to be in. You want to use a language that can build the JSON for you from a simple list you give it. JavaScript (works with Alfred’s /usr/bin/osascript (JS)): const my_list = ['Red', 'Green', 'Blue'] // Your example list let script_filter_items = [] // We will build this array with the elements for the Script Filter my_list.forEach(element => { // For each item in your list script_filter_items.push({ 'title': element, 'subtitle': element, 'arg': element }) // Add them to the empty array }); JSON.stringify({ 'items': script_filter_items }) // Transform it into JSON Alfred understands Ruby require 'json' # We need the JSON gem, to be able to use JSON functions my_list = ['Red', 'Green', 'Blue'] # Your example list script_filter_items = [] # We will build this array with the elements for the Script Filter my_list.each do |element| # For each item in your list script_filter_items.push(title: element, subtitle: element, arg: element) # Add them to the empty array end puts({ items: script_filter_items }.to_json) # Transform it into JSON Alfred understands
  11. 1 point
    Sure, but it might take me a week or two before I can get it written up. Feel free to nag me.
  12. 1 point

    (faster) Menu Search

    I have re-implemented ctwise's excellent implementation of the Menu Search workflow in Swift. This version is ever so slightly faster (at least on my machine ) - YMMV. Requires OSX 10.7+ Download Setup Accessibility must be enabled for Alfred in order for this to work properly. For example, in macOS Sierra, this is configured using the Security and Privacy preference pane, under the Privacy tab with the Accessibility section selected. Alfred must be included in the list of apps allowed to control your computer. This step is required for the workflow to generate the list of menu items, and also click on a specific menu item. Here's a snapshot of what the preference pane might look like in macOS Sierra. Usage Type m in Alfred to list menu bar items for front most application You can filter menu items by name, or do a fuzzy search. E.g m new tab will match the menu item New Tab m cw will match the menu item Close Window Settings You can change the workflow environment variables to fine tune menu listings -show-disabled true/false controls if diabled menu items should be shown (default is false) - change this setting if certain items are not displayed, even though active -show-apple-menu true/false if true, menus items under the apple menu will be shown (default is false) -max-children number how many sub-menu items to load for each menu item (default is 30) -max-depth number how many nested levels if sub menus should be listed (default is 10) v1.6 and above You can also have customised settings per app. Typing ms into Alfred will give you a list of options to configure your settings.txt config file. The workflow comes bundled with a sample configuration file for reference. Your app settings will override any workflow level variable settings you may have specified. Here's the settings file I use for reference: # always show disabled menu items appFilters { app: "BibDesk" showDisabledMenuItems: true } # for Safari, ignore the History and Bookmarks # menus since loading it take a lot of time appFilters { app: "Safari" ignoreMenuPaths { path: "History" } ignoreMenuPaths { path: "Bookmarks" } } # For Finder alone, show the Apple menu entries, # and ignore any recent entries listed in the # Apple > Recent Items menu appFilters { app: "Finder" showAppleMenu: true ignoreMenuPaths { path: "Apple" path: "Recent Items" } } Change log 1.0 - Initial Release 1.1 - Added Fuzzy Text Matching for Menus If you have a menu item New Tab, then typing m nt in Alfred will match New Tab, since n and t matches the first letters of the menu text. 1.1.1 - Changed run behaviour to terminate previous script, this makes the experience slightly more faster 1.2 - Completely native menu clicking, removed reliance on AppleScript 1.2.1 - Performance improvements when generating menus using direct JSON encoding 1.2.2 - More performance improvements while filtering menu items 1.3 - Added -async flag to allow threaded scanning and populating of menus 1.4 - Added -cache setting to enable menu result caching and also set a timeout for cache invalidation 1.4.1 - Invalidate cache (if present) after actioning a menu press 1.4.2 - Slide the cache invalidation window forward in case we get invalidated by a near miss 1.4.3 - Speed improvements to caching, text search and fuzzy matching 1.4.4 - Added -no-apple-menu flag that will skip the apple menu items 1.4.5 - Tuned fuzzy matcher, allows non-continuous anchor token search 1.5 - Faster caching using protocol buffers 1.5.1 - Reduced file creation for cache storage 1.5.2 - Better support for command line apps that create menu bar owning applications 1.5.3 - Protocol buffer everything - microscopic speed improvements, but hey... 1.5.4 - Added various environment variables to fine tune menu listings 1.5.5 - Tweaked ranking of search results for better menu listings 1.6 - Per app customization via the `settings.txt` configuration file
  13. 1 point
    Mine shows search suggestions. This one scrapes the actual search results from the webpage. That's the reason it breaks quite often.
  14. 1 point
    @vitor - Searchio! is great, but the main difference was, as far as I can tell, actioning the searchio 'results' takes you to the google results page, whereas actioning this workflow's results actually took you to the result's URL. aviaryan's workflow's results: Searchio's results: So, the original workflow from this thread is 'better' if you know what you're looking for - it saves you the step of going to the google page.
  15. 1 point
    I found this answer from Alfred. This behavior is deliberate. Many users told us that Typinator made unwanted replacements in this situation and asked NOT to expand abbreviations in Alfred's search window. For this reason, we have made this the default behavior in Typinator 8.0. However, you can revert to the previous behavior with a hidden setting. To do so, execute the following command in Terminal: defaults write com.macility.typinator2 expandInAlfred 1
  16. 1 point
    @cebroski in addition to what @deanishe said, I would recommand to remove also the last part of the scipt so it doesn't close an already opened tab. I mean, remove: -- close the first default tab tell application "System Events" keystroke tab using control down delay 0.2 keystroke "w" using command down end tell However, if I understand well what you want, I think it would be better/easier/faster to use the Alfred's builtin 'Open URL' object. The idea is to have a Keyword object (or another trigger) that connect to 2 'Open URL' objects that send your specific URLs to Firefox. Here is an example workflow that should do what you want: https://d.pr/f/jsvmIY Make sure to check the "Open links in tabs instead of new windows" in the Firefox Preferences.
  17. 1 point
    Thanks guys for the help! fyi: https://github.com/Acidham/search-alfred-workflows is now supporting keyboard shortcuts!
  18. 1 point
    see keyword hot in
  19. 1 point
    @jayhlee These are two different modes; In Alfred's default results, Cmd + number actions the result (e.g. if it's an app, it'll launch the app, if it's a folder, it opens the folder, and if it's a custom search, it performs the search in your default browser) In File Navigation mode (which is the mode you enter with the Previous Path hotkey), Enter navigates into the folder As such, the preferences under File Search > Navigation only apply to the File Navigation mode. If you want to navigate into a folder from Default Results, you can use Cmd + down to enter File Navigation mode and browse the contents of a folder. Cheers, Vero
  20. 1 point

    Can I Save Screenshots to Clipboard?

    ... or Cmd+Shift+4 and then hold the CTRL key while snapping, which also makes the output go to the clipboard
  21. 1 point
    @Andrew 4.0.7 fixed the problem! I don't really see any noticeable delay (but I am on a 6-core i7 Mac Mini 2018 so it's possible older machines might). I'm happy with this fix!
  22. 1 point
    @luckman212 this should now be sorted in the 4.0.7 pre-release
  23. 1 point

    Calculate Anything

    Hi @vitor I've added OneUpdater, did some tests and it seems to work without problems, it's now available in version 1.0.5 with some changes and bug fixes and a new way to configure the workflow. Thank you for OneUpdater it is really simple to use.
  24. 1 point

    Offline Unit Conversion Workflow

    Alfred is (being a native application), but it doesn't share that information with workflows. You can use the command defaults read -globalDomain AppleMetricUnits to ask whether the OS is set to use metric.
  25. 1 point
    Hi @vitor is there a difference between setting "download_type" to "github_release" and setting the download type to direct and in the workflow_url setting the url to the latest release for example "https://github.com/user/repo/releases/latest/download/weorkflowname.alfredworkflow"? Also after implementing the updater I did a test and it notified me about and update (it downloaded the workflow from GitHub correctly and asked me to update, everything good here) except that there was no update, the thing is that I forgot to push the updated "info.plist" to GitHub (the one in GitHub said 1.0.0) while my workflow was in version 1.0.4, so it appears that the updater only does a simple comparison like $v1 !== $v2 instead of actually checking if the release version is bigger than the current version. So my question is do you think this could cause an issue (not now and not in my case) in the future with any workflow where the author forgets to change the version or something happens? or am I just dumb for making such mistake? Anyways, I think this is awesome, it's really simple to implement and it could basically be implemented in any workflow. As a new Alfred user I spent a few weeks looking and testing workflows you can find 3 or 4 different versions of the same workflow, outdated information, outdated links, etc. and it appears that there's not a single source where everyone could look for workflows (apart from the forum and I'm not sure this is the best way) I hope OneUpdater could become the standard for handling updates. Thank you for sharing.
  26. 1 point
    Welcome @stevemoser, Hotkey Triggers have a Related Apps tab. You can drag Alfred there and make it so your Hotkey will only trigger when Alfred has focus. The rest of the Workflow might not be obvious, as you’ll need to grab Alfred’s text and use that as the query. Here’s a ready-made Workflow.
  27. 1 point
    @luckman212 Thanks for spotting this - I'll get it fixed in the next release
  28. 1 point
    Why are you grabbing the file location via AppleScript invoked by a Keyword, instead of using a File Action Trigger? That’s the best tool for the job. You can even prevent the Workflow from messing up by having the File Action Trigger only work on the +public.text type. On another note, cat "$1" | pbcopy is a useless use of cat. Do pbcopy < "${1}".
  29. 1 point

    Kernel Panics?

    A few things of note here: Alfred runs as a user level process, and doesn't install any lower level OS based extensions, so isn't even capable of creating a kernel panic. This is unless one of the macOS APIs Alfred is using is bugged or corrupted, more likely the latter as this is the first mention of this I've heard. There is no underlying rendering differences between 4.0.5 and 4.0.6, so I'm certain that the behaviour difference is purely coincidental. A few users have seen graphics bugs in Catalina in both the Alfred window and the macOS dropdown and popup menus (where Alfred isn't installed) based around the window blur. If you select the Alfred Classic theme (or create a custom theme and set the window blur to 0), then this will rule out the blur causing a GPU issue. Have you tried running on a new user account to rule out another underlying app (which you may not even know is installed) interfering with your Mac's operation. Kernel panics are unusual, but Catalina is new and notoriously buggy still. If you upgraded via an old OS, or via the macOS Beta path, there may be an underlying OS corruption or misconfiguration. Are there other quirks you are experiencing on your Mac? Cheers, Andrew
  30. 1 point
  31. 1 point

    Chromium Bookmarks and History Search

  32. 1 point
    I'm running Catalina, and Alfred 4 (build 1118). When typing "Photoshop" or "Illustrator" into the Alfred input field neither app shows up. They both show up when using the Spotlight search. I've checked the Spotlight settings and `/Applications` is indexed, and in fact other apps in that same folder show up just fine. I've performed the `reload` command in Alfred several times. I've also completed the `rebuild macOS metadata` command. Here's the Photoshop meta data using the Alfred metadata tool.
  33. 1 point

    Safari Assistant

    Safari Assistant All-in-one workflow for Safari. Filter tabs, bookmarks (and bookmarklets), reading list and history. Several built-in actions. Easily add your own via scripts. Assign your favourite actions (or bookmarklets) to alternate actions (i.e. ⌥↩, ^↩ etc.). Download from GitHub releases. Source code. Built-in tab actions: Close Tab Close Window Close Other Tabs Close Tabs to Left Close Tabs to Right Built-in URL actions (also work on tabs): Open in Private Window Open in Default Browser Open in Chrome Open in Firefox Usage bh [<query>] — Search and open/action bookmarks and recent history. ↩ — Open item in browser. ⌘↩ — Show URL actions for selected item. ⌥↩ — Run custom action on selected item. ^↩ — Run custom action on selected item. fn↩ — Run custom action on selected item. ⇧↩ — Run custom action on selected item. bm [<query>] — Search and open/action bookmarks. ↩, ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above. bml [<query>] — Search and run bookmarklets. ↩ — Run bookmarklet in active tab. bmf [<query>] — Search bookmark folders. ↩ — Enter folder/open bookmark. ⌘↩ — Open all bookmarks in folder/show URL actions for bookmark. hi [<query>] — Search and open/action history entries. ↩, ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above. rl [<query>] — Search and open/action Reading List entries. ↩, ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above. tab [<query>] — Search and activate/action Safari tabs. ↩ — Activate the selected tab. ⌘↩, ⌥↩, ^↩, fn↩, ⇧↩ — As above. See the README on GitHub for full usage instructions.
  34. 1 point

    Duplicate apps in results (10.15 and V4)

    @unitof Alfred is showing the actual location of the apps as passed back to him by macOS when searching. I'm going to be adding a bit of logic to be able to show the virtual locations of the apps (/Applications/.../) in a future release. Cheers, Andrew
  35. 1 point
    @gingerbeardman Thanks for this great workflow, this is exactly what I needed! Are there any new developments since? I was looking at your script and have a suggestion which might be less prone to changes in the UI. You could replace the search/input part: set value of text field 1 of group 2 of toolbar 1 of window "Keychain Access" to q click button 1 of text field 1 of group 2 of toolbar 1 of window "Keychain Access" To something like this, using the menu bar instead: click menu item "Find" of first menu of menu bar item "Edit" of first menu bar keystroke q
  36. 1 point

    Removing keywords in fallback searches?

    @cabsuwepa, here it is: https://d.pr/f/X5kfAF
  37. 1 point
    Hello everyone, Here is a full collection of themes to embrace macOS Mojave's new Dark and Light themes and their respective accent colors! Each one hase been carefully designed with a pinch of the accent color's hue in each element. I've chosen to respect the low contrast Yellow Accent color shipped by Apple in macOS, despite not being fond of it. It comes in Blue, Purple, Pink, Red, Orange, Yellow, Green & Gray, each with a Dark and Light variant. You can have the color you want, as long as it's not black! There is now a workflow made for this themes collection, which allows you to switch easily between Dark & Light mode, and select your Alfred theme's accent color. Here is a quick demo: TL;DR: How to Install ? You can find all the previews in High Res and link to each theme on Alfred's website on my repo: https://github.com/AlexMartinFR/mojave-alfred-accented-themes Enjoy
  38. 1 point
    It would be great if one could exclude from all search results files with a specific extension. There are files in my Documents folder that I never want to look for, e.g., compiled files such as byte code for Python classes (.pyc), Java libraries (.jar), Java compiled classes (.class), automatically generated web pages (.html files) and so on. I guess adding an option that hides files with some user-specified extension from Alfred search results should not be hard to implement (also in a second step, i.e., it is not necessary to exclude them from Alfred index, but just hide them a posteriori in the search results if specified). I think users could benefit from this, having personalized search results.
  39. 1 point
    Sam Michel

    Bluetooth Toggle

    Very handy script, but it stopped working for me with Mac OSX Mojave. I found this alternative AppleScript which seemed to do the trick - just replaced the Run NSAppleScript section of the workflow and it works now: #!/usr/bin/osascript on alfred_script(q) tell application "System Preferences" reveal pane id "com.apple.preferences.Bluetooth" -- activate set the current pane to pane id "com.apple.preferences.Bluetooth" try tell application "System Events" to tell process "System Preferences" click button "Turn Bluetooth Off" of window "Bluetooth" click button "Turn Bluetooth Off" of sheet 1 of window "Bluetooth" of application process "System Preferences" of application "System Events" end tell delay 1 on error tell application "System Events" to tell process "System Preferences" click button "Turn Bluetooth On" of window "Bluetooth" quit end tell end try end tell end alfred_script
  40. 1 point
    Kim Aldis

    Python 3 Support?

    Resurrecting this; Python 2.7 comes to end of life next January. I wondered what your thoughts are
  41. 1 point

    Cardhop Workflow

    @michaelwills sorry for the long delay! I got too much work on my side with no free time. Things are starting to settle down Sorry that the nofile.io link is not working anymore. Actually, I had a small update on my side that I needed to push here ;) So here it is: Update Version 1.2.5 What’s new: Cardhop Actions list should be in your own language (I’m getting the localization from the Cardhop application directly, so you should get the same thing as in the application) Some bugs fix Download link: https://d.pr/f/rQTPtu @michaelwills regarding the coffee, actually, I like pretty much all kind of coffee :) I’m not very difficult All the best!
  42. 1 point
    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.
  43. 1 point
    Variables don't work that way. See the pinned thread:
  44. 1 point
    Call top for an auto-updating list of processes, ordered by CPU usage. Type to filter by process name. On each process: ⌘↵ quits. ⌥↵ forcibly kills. ⌃↵ limits CPU usage. fn↵ lowers priority (increases niceness). ⇧↵ freezes. ↵ gives more granularity over the options. Download | Source
  45. 1 point
    Find and paste unicode symbols. I included a lot of them, like really a lot, over 20k I think, but for me workflow works pretty fast. Symbol can be pasted as symbol (mh...), in html encoding, as python string and as unicode code point. Download: https://github.com/bevesce/unicode-symbols-search/raw/master/Symbols.alfredworkflow Source: https://github.com/bevesce/unicode-symbols-search
  46. 1 point
    Hongbo Miao

    Bluetooth Toggle

    Thank you!
  47. 1 point
    Since you are new to Alfred 2, let me explain the difference in case it wasn't already obvious. A run script (with the language set to bash) is the same as running the command from the terminal except it runs it in the background with no new windows popping up. Terminal command will launch a terminal window and run the command in that new window. If a command works normally in a Terminal Command item, then it should work normally as a Run Script with the language set accordingly as long as the script isn't reliant upon something in your profile settings or environment variables. Alfred doesn't import your environment so, if you have environment variables set that the script would need access to, these would need to be brought into Alfred. Also, paths in Alfred are relative to the folder that the workflow is stored in. So if you needed to access something in your documents folder, you wouldn't just use "cd Documents" assuming that you started in your home directory, you would have to specify full path to your Documents folder.
  48. 1 point
    I have the same problem. I already rebuilt the Spotlight cache and did a reload and all the other fairy dust things that get recommended. However, they are only temporary fixes or don't work at all, depending on today's weather or some other unknown variable. Spotlight finds my items immediately, Launchbar finds my items immediately, Alfred 2 worked perfect until maybe two weeks ago (I don't have a good event log, but I'd wager that problems started with the newest version). Now, while I can resort to rebuilding my Spotlight cache, it may or may not help and if I have to do that every day then Alfred starts to look not as attractive anymore. Also, restarting is often not possible as this machine is running complex multi-day calculations frequently.
  49. 1 point

    Insert (Unicode) Character

    Before I saw that bevesce had already created this (with more features), I finished one of my own. Anyway, it makes it easy to search and insert Unicode characters by their name in the current text (if it's supported). Here's the download Here's the source Technical details: For the technically interested, the difference between this and bevesce's is that this is written in ruby as opposed to Python and has the characters hard coded in this script. It makes it slightly faster with the expense of including only a subset of all possible characters. There is a limit to how big the script, or the array in it, can be it seems or it will crash when being loaded by Alfred. Keep up the good work!
  50. 0 points

    EggTimer v2 [updated to 2.0 final]

    the `recent` option seems broken for me, even in the version @Russell Davis provided, on macOS 10.14 Mojave. I can't see the alarms I'm setting after typing `recent`, it says there are no alarms or timers set. Does anybody else have the same problem?
  • Create New...