Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation since 05/14/2021 in Posts

  1. Scriptability matters for Alfred Workflows, so this is a short thread on what we know about scriptability on the new macOS version. Discussion and new data is welcome; I’ll strive to keep this top post up to date with the most relevant information. Scripting languages might have survived another version: Shortcuts is coming to macOS, but it doesn’t mean the end of AppleScript yet: The Shortcuts app will scriptable, though the functionality isn’t yet available. It will also have a command-line tool: On June 8 there was a session going more in-depth into Shortcuts. Notable points: “We also added two new automation types for Focus and Sound Recognition”. “By the way, if your app integrates with file providers, these new Files actions will automatically work with the files that your app provides”. “We also have a new file format that lets you distribute Shortcuts as files“. (…) “This means that you can distribute your own Shortcuts on your website or in your app”. Which means we may be able to distribute Shortcuts as complements to Workflows. For M1 Macs, that may open a window to distribute everything needed to control iOS apps from Alfred. However, it’s unclear if we’ll need a ($99/year) Developer Account to distribute them in useful form, since they mention signing: “Shortcuts files are notarized by Apple to make sure they’re safe”. (…) “a new mode for sharing Shortcuts privately” (…) “Shortcuts files are signed with the identity of the person who sent them. If you need to re-sign a Shortcut, you can use the new Shortcuts command-line tool”. “Shortcuts has full support for AppleScripts and Shell Scripting”. Not dead yet! “Shortcuts is the future of Mac automation”. Taken in isolation; it’s a scary implication the other technologies are destined for the bin. But in context, they’re talking speficially about replacing Automator. “There’s a Shortcuts command-line tool which lets you list and run Shortcuts in your Shell Scripts or command-line tools”. “If you develop an app or a script that would benefit from the ability to run Shortcuts, you should use the Scripting interface. By communicating with the “Shortcuts Events” process, your app can get a list of shortcuts that the user has set up, as well as start running one. In AppleScript, you can accomplish this by telling the “Shortcuts Events” process to run a shortcut by name”: tell application "Shortcuts Events" run the shortcut named "Make GIF" end tell “Finally, macOS Monterey also includes a command-line tool that can list shortcuts and run them by name. If you have command-line tools or scripts, they can integrate with Shortcuts via this interface”. OVERVIEW: Command-line utility for running shortcuts. USAGE: shortcuts <command> OPTIONS: -h, --help Show help information. SUBCOMMANDS: run Run a shortcut. list List your shortcuts. view View a shortcut in Shortcuts. sign Sign a shortcut file. See 'shortcuts help <subcommand>' for detailed help.
    5 points
  2. @Mr Pennyworth To find URL schemes supported by an app, reading the ${app_path}/Contents/Info.plist file and looking for CFBundleURLSchemes tag if often enough. Or doing /usr/libexec/PlistBuddy -c 'print :CFBundleURLTypes' "${app_path}/Contents/Info.plist". But I think you’ll like this more: /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump URLSchemeBinding. It shows every available URL scheme (on your machine). As to how to use them, that’s the job of the developer’s documentation.
    4 points
  3. So you’ve just updated to the new buggy shininess released by Apple. Congrats! But thread lightly. At all costs, you should avoid installing a beta macOS version on a machine with data you can’t afford to lose or waste a day resetting. In the course of your beta trial, you’ll bump into bugs and general issues. Some will be related to Alfred and Workflows, which will make you tempted to jump on this forum for help. Stop! Then wait. Ask yourself “is this a bug I should be reporting?” The closer to WWDC21, the likelier the answer is “no”. The overwhelming majority of bugs at this point will sort themselves out. And they are inconsistent. At the time of writing there have been two comments from users on the new macOS beta: one said Alfred worked, the other that it didn’t. At this point the new beta is so unstable we can’t even rely on a consistent experience between users, meaning no way to isolate and understand problems—effort spent in that direction wold be wasted. Avoid drowning the forum with unactionable bug reports. In general, if you don’t have enough knowledge or skill to figure out the cause of the problem, you should refrain from installing a beta OS. Please avoid filling but reports if that’s the case. Or file them at Apple, since it’s their end causing the breaks and giving them feedback is the point of installing their beta OS. So when should you start reporting general Alfred bugs? Look at the bug reports subforum. Do you see a “macOS 12.0 Monterey Bugs & Issues” section? If not, it’s too soon. What about Workflows? You should follow the same logic. If a Workflow stops working, either the developer will know because they are using the beta, or they won’t know and won’t be able to fix it anyway because they are not on the beta. There are exceptions to the above, but few. If you do make a bug report, please make sure to follow the instructions. Do that, and everyone will be more willing to look into your issue sooner and help get you sorted. Thank you. Have fun with the new features.
    3 points
  4. I just release version 1.2.6 of the workflow, which has the following changes: Match 3 and 4 digit codes if they immediately follow "code" or "is" (e.g. "your code is 1234", "enter code 573 to log in") Thanks to @luckman212 for the PR! Download the latest release: https://github.com/squatto/alfred-imessage-2fa/releases/download/v1.2.6/iMessage.2FA.alfredworkflow
    3 points
  5. I am unfortunately a potato... 😕 aha jk okay thank you for the reply and answer
    2 points
  6. CleanShot X Workflow: Download Requiremens Alfred 4CleanShot X (version 3.5.1 or above) Screenshots Credits This workflow is based on, and a slight improvement of, Raycast’s CleanShot X script commands. Icon Credits Some icons from by srip and freepik from flaticon.
    2 points
  7. Nvm. Found your github repo (https://github.com/deanishe/alfred-workflow/blob/master/workflow/background.py). I'll go thru this and figure out myself. Didn't expect I was getting help from special forces!
    2 points
  8. i'm going to make this change for the next release, and I'll update the documentation to mention using arg when quicklookurl is not set. If this causes a vast unexpected impact, I'll take a second look.
    2 points
  9. This workflow has been updated to allow QR code creation with a selection hotkey. If either the selection contains nothing or the qrc/qrp keywords don't have a parameter, then the clipboard is used. Thanks @vitor for those ideas to improve the workflow!
    2 points
  10. Summary All of the QR code generator workflows I've come across use a dependency, such as an external installation, embedded app, or web service. Given that MacOS can create QR codes natively, that's what I did with this workflow. Usage I've configured this to use two different keywords, qrc & qrp. The qrc keyword creates a QR code that copied to the clipboard. The other keyword, qrp does the same thing, except at the end it'll open the QR code in Preview to allow saving as an image/pdf. When using either qrc or qrp without a parameter this workflow will attempt to use text contained on the clipboard. This same flow is followed if you set a hotkey for the selection and nothing is selected. Download https://github.com/TorreyBetts/Alfred-QRCode/releases/download/v1.0.2/QR.Code.alfredworkflow GitHub https://github.com/TorreyBetts/Alfred-QRCode
    2 points
  11. Your try ... except is in the wrong place: the script will fail on read 99.9% of the time, not write. But in any case, you generally just put it around the entire per-item code: from __future__ import print_function import json import sys n = 0 # number of files processed for path in sys.argv[1:]: try: with open(path) as fp: data = json.load(fp) with open(path, 'w') as fp: json.dump(data, fp, indent=4, separators=(',', ': ')) n += 1 except Exception as err: # anything written to STDERR goes to Alfred's debugger print('[error] file %s: %s' % (path, err), file=sys.stderr) plural = ('s', '')[n==1] # anything written to STDOUT goes to the next action (i.e. arg/{query}) print('Prettified %d file%s' % (n, plural), end='') Variables and arg/{query} are two different matters, and Script Filters and regular Run Script actions are two different things again. In this case, you don’t really need to use variables, because you only need one output: the notification. So you can just print the notification text because anything you print becomes the next element’s arg/{query}. Important: If you’re going to get into writing Python, you should stop using /usr/bin/python and use /usr/bin/python3 instead. (You’ll have to use Alfred's External File option for Language and the shebang #!/usr/bin/python3 to do that.) Python 2 is dead and will be gone soon, and Python 3 is easier to use, anyway.
    2 points
  12. You'll need to set keywords for the Snippet Triggers as these are stripped from the workflow to avoid clashing with your own. For example, I've set them to these... Just keep in mind the shared prefix in your Snippet Triggers setup, so I've only set them to "tw" and so on, and the \\ prefix is set globally for all my snippet triggers. You've no doubt figured that in @dfay's example, you can set the name and address in the environment variables under the [x] in the top right of the workflow canvas You can read more about the snippet triggers object, or see the few scenarios with dynamic content within the snippets as examples too. Nested snippets and snippets trigger based workflows generally are really good fun and ever so useful.
    2 points
  13. Here’s a script that can import your macOS text replacements into an Alfred snippet collection.
    2 points
  14. Using Beeminder to track your goals? You might be interested in this workflow to manage and update your Beeminder goals. Thanks – as usual – to @deanishe and @vitor for their guidance and templates. Feedback welcome! https://github.com/giovannicoppola/beeAlfred
    2 points
  15. Please post your Workflow somewhere when asking for help. It’s not possible to debug your issue from a mostly empty screenshot and the name of a script. We have zero idea of what your code is doing.
    2 points
  16. @fxf Try "remove" or "cancel" as a keyword to search. "x": { "keywords": ["no", "delete", "remove", "cancel", "red"], "char": "❌", "fitzpatrick_scale": false, "category": "symbols" },
    2 points
  17. No idea how I missed this! Thank you! Great work!
    1 point
  18. Same issue here!! I set up a lot of short texts, so it's very annoying for me. In other Apps, like Google Chrome for example, go to the menu bar and choose "Edit > Substitutions > Show Substitutions > Text Replacement" and deselect Text Replacement. This could turn off the text replacement feature. But, there' no menu bar show with alfred's input box! I can find the same menu with mouse right click on it, and can be disable temporary, but it won't save! Text replacement will re-enable after reboot. Can't find a solution....
    1 point
  19. It's not the calling that takes the time, it's the importing.
    1 point
  20. subprocess.check_output() is a bit simpler.
    1 point
  21. @jth214 The line numbers in your error log do not correspond to the source code of the current version of the workflow. It looks like you're using an outdated version. Please make sure you're using the latest version of a workflow (or any software, really) before reporting a problem with it: it may have already been fixed.
    1 point
  22. @Chris Messina Thanks for the reminder! Been meaning to update this a bajillion times, but when I come to the forum, I just crack on with answering questions and forget every time. I've just updated it to be light grey instead so should be easier to read
    1 point
  23. Mr Pennyworth

    CleanShot X Workflow

    @paulminors I uploaded a "fix" https://github.com/mr-pennyworth/alfred-cleanshot/releases/download/0.0.5/CleanShot.alfredworkflow Can you try it and see if it works? Because I don't have Big Sur, it was not possible for me to test it. Let me know in either cases whether it works or doesn't
    1 point
  24. deanishe

    FR: Markdown Snippets

    This. Your suggestions can be focussed very tightly on your own specific needs, @Chris Messina. The all-important question is how well or poorly a change or feature would work for all Alfred users. Vítor and I give your requests a bit of a hard time because we're measuring them against that bar. But what leads you to think what you're suggesting is the 80%, especially when you're implicitly excluding everybody who'd rather use something other than Markdown from the get-go? Why aren't we talking about the ability to run snippets through any processor? The same end result as far as you're concerned, but also useful to people who don't want to do exactly the same thing as you. You'd want to put HTML on the clipboard as well (or perhaps instead), imo. That's the "proper" representation of something like Markdown, and some apps (yeah … Firefox) accept pasted HTML, but not rich text. I think the ability to put multiple arbitrary types of data on the clipboard is more interesting in general, tbh. Without even getting into anything semi-complex like rendering Markdown, the ability to put a URL or file:// URL (or even a file list) on the clipboard would be broadly useful. It's a pain to do in code.
    1 point
  25. Right yeah, good point: workflows keep running when a Run Script action fails, so your original version also needs some kind of hand-rolled error check before the Write Text File. But the script is inherently fail safe because it will error out decoding the file and never run the code that overwrites it.
    1 point
  26. One of my workflows logged so much, it broke Alfred.
    1 point
  27. Your workflow's set up the wrong way for that. A File Action can output an array, and a script can accept multiple arguments (provided you use argv), but most other elements can't handle multiple inputs and will squash them into a single string. Write Text File can only write one file, so if you need to handle multiple files, you have to do it in code. Like this.
    1 point
  28. @Cyberskier @JakeS could you try the latest release and see if works on M1 macs? (I don't have access to an M1 mac) Technical details: The workflow no longer depends on nodejs
    1 point
  29. alfred-spotify-mini-player.com Find all information on dedicated website: alfred-spotify-mini-player.com Follow on Twitter @TheMiniPlayer to get all news Features Example PS: If you have a problem with the workflow, do not spend time reading the forum post, the workflow has been rewritten many times! Follow instructions from here http://alfred-spotify-mini-player.com/articles/support/ instead
    1 point
  30. @Cyberskier apologies! The workflow right now doesn't support M1, and I'm not sure how much of a work it would be to support it. Technical details if curious: The workflow ships with compiled binaries (an entire nodejs runtime and a swift app). As they aren't universal binaries, it won't work on an M1 mac. I'm working on getting rid of nodejs right now. After that, I'll look into making the swift app universal.
    1 point
  31. @JakeS I'm going to get rid of the javascript and node-bundling altogether. Will post an update here once done in next day or two.
    1 point
  32. dfay

    RPN calculator

    I'd like to say it's by design but it's actually an artifact of the crazy regular expression in rpn.py line 42: ops = map(lambda y: y.replace(' ',''), re.split('\s|(?<!\d)[,.]|[,.](?!\d)',query))
    1 point
  33. Understood - and I apologize for tiptoeing.
    1 point
  34. giovanni

    Calculate Anything

    this link on this page
    1 point
  35. In the meanwhile, if you insist on CSV instead of excel sheets, here's a workflow for you: https://github.com/mr-pennyworth/alfred-lf2csv Example setup: 1) set hotkey to cmd+option+c 2) in the workflow editor, select the list filter you want to export as csv 3) press the hotkey (cmd+option+c), alfred should have a CSV file ready to be dragged-and-dropped
    1 point
  36. Major update! Your usage won’t change if you don’t want to. First, I’ve done a big code cleanup. Second, the list will now auto-refresh every few seconds, which is a great way to monitor for changes. Third, I’ve revamped how the file list is cached (only applicable when sorting by added): Previously, on every run it would read from the cache unless the directory had changed, in which case it would have to save a new cache. This means that if your directory changed quite often, you’d see little gain from caching. Now, no caching is done by default. If you want caching, run :recentdownloadslaunchd which will install a launchd agent to watch your directory and save a new cache when the directory is modified. This means your cache will always be up to date and you’ll get the fastest run every time. This leverages technology built-in to macOS, there’s no weird hacks. Fourth, I’ve worked around a pesky Spotlight bug when it sometimes returns (null) in a result, which is annoying if it gets saved to the cache because you wouldn’t be seeing the real path. Finally, thanks to the above I removed the option to manually delete the cache. To update, download the latest version (same URL) or wait a few days and it’ll prompt you to on next usage, since it uses OneUpdater.
    1 point
  37. deanishe

    introducing beeAlfred

    It does, but it's much more restrictive (gotta use GitHub releases, semantic versioning) and is more effort to integrate. @giovanni You need to remove the .pyc files and __pycache__ from the repo/workflow and add *.pyc and __pycache__ to your .gitignore. Those files shouldn’t be in the repo, and especially not the released workflow. They’re bytecode files that Python generates automatically, so you don’t need them in there, and they’re Python version-specific, so you don’t want them in there, or your workflow will refuse to run on a different version of Python.
    1 point
  38. giovanni

    Passing variable to app

    have you checked the debugger? What does it say? I noticed you had `search {query}`, have you tried without `for`?
    1 point
  39. godbout

    Alfred Time 2.0

    4.2.1 is out: https://github.com/godbout/alfred-time/releases/tag/4.2.1 * handles new Toggl API URL
    1 point
  40. Thank you! Alfred can do that on its own. It checks how fast you type and adds an automatic delay after each character so it tries to run as infrequently as possible, ideally only when you stopped typing. I tend to always turn that on, but this Workflow is pretty old so I don’t recall if the feature was available when I first built it. Either way, I checked and seems I forgot to turn that on. It’s now how it works (download the latest version, just released), so you should be seeing a significant decrease in requests. Thank you for noticing.
    1 point
  41. @Michal Bryxí have you added com.google.gsheet to Alfred's default results? You can do this in Alfred's Features > Default Results > Advanced. Having said that, I find that It's best to keep Alfred's default results as focused as possible, and use the file search mode for searching files. This is particularly important when you start using more features and workflows within Alfred, and will prevent the results from becoming noisy with files.
    1 point
  42. juch3059

    Alfred-Anki

    Hi Hi, This community is pretty much dead. I posted one similar question a few months back and nobody replied. Thankfully I was able to solve it my own and therefore deleted my post. Unfortunately I don't understand any code and cant help you out with your problem but if you could share a video of it, I might be able to help you out.
    1 point
  43. Is there a way to always have a couple of favorite folders right in the Alfred search bar for quick access? I know there is the Favorites workflow but I'd like it even faster
    1 point
  44. deanishe

    Questions from newbie

    Absolutely. Alfred doesn’t upload any data to its creators or anyone else. In theory, it's potentially risky. In practice, it's just not an issue. Alfred is too small to be an attractive target. But If someone did create a malicious workflow, there are enough paranoid users (like me) running all manner of security software that it would be quickly spotted. If you must worry about something, worry about bugs, not enemy action.
    1 point
  45. vitor

    Questions from newbie

    Welcome @bebek. To both the Alfred forums and macOS! For many (most?) of us, Alfred is the first app we install on any Mac and we almost feel useless using macOS without it. It can get that ingrained in your usage. Like every closed-source software, you have to trust its creators. I wholeheartedly trust Alfred’s team (@Andrew and @Vero) and I recommend you stick around to meet them in the forums. You’ll see they care deeply for Alfred’s users and they have everything to gain from being truthful. Plus, they’re nice people in general. That’s indeed something different, and your reluctance in understandable and healthy. You definitely should install Workflows—like any other software—from people you trust. That said: In these forums, you’ll find plenty of prolific developers with dozens of released Workflows. Get to know us and decide if you should trust us. I think you should! I’ve never heard of an invasion of privacy or security from an Alfred Workflow. In fact, most (all?) don’t even so much as have analytics! The overwhelming majority of Workflows are built in scripting languages, meaning anyone can inspect the code. Hiding something malicious isn’t too viable, especially in popular Workflows. The latter, as I don’t see myself giving up Alfred any time soon. But no software satisfies everyone’s needs and we don’t know each other, so I can only tell you what I’d recommend myself.
    1 point
  46. For those who absolutely must to have some shortcuts to open different Chrome profiles but can't use this Workflow extension, here is a little something that is very minimal but helps me navigate through my profile. You can create your own Alfred workflow, that triggers by an input with arguments. Link this trigger to a "Run Script Action" object. Configure the Script Action with the following snippet: query=$1 /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --args --profile-directory="Profile $query" This will take your first argument of the commend and append it to the "Profile " word. Now, I have list of profiles in my chrome that I would like to open. I simply associate them with numbers in my head (I don't have that much). To help you find the number of the profile, or as a matter of fact, an actual identifier of the profile in case you have something different that just Profile #number Open your Chrome profile, type in search bar "chrome://version" You will find the profile name and its path by: Profile Path /Users/<YOUR USER NAME HERE>/Library/Application Support/Google/Chrome/Profile 1 So this number at the end is what I swap out when switching between profiles. Simple, quick hustle This by no means a production ready workflow, but for those who couldn't even try out the current workflow due to the error above and need some solutions. This what it looks like for me in the end CHROME: And SCRIPT:
    1 point
  47. Those are two different themes, as far as Alfred is concerned: Alfred doesn't have a concept of theme variants. To set your light theme, choose an Alfred theme when the macOS colour scheme is light. To set your dark theme, choose a theme when macOS is in dark mode. Alfred will remember those choices and switch between them when the OS switches between light and dark modes.
    1 point
  48. Sure, but it does a crap job of fill-in snippets, which is what this thread is about. EDIT: I think I've been talking about something different to everybody else. Alfred is fine for inserting a single placeholder. It's a bad fit for multiple placeholders, however, which is what I fundamentally associate fill-in snippets with.
    1 point
  49. @mattbovett Just implemented Bookmark Search Since I am not using Browser Bookmarks please test and let me know if there are issues.
    1 point
×
×
  • Create New...