Jump to content

deanishe

Community Hero
  • Content Count

    6,269
  • Joined

  • Last visited

  • Days Won

    366

Everything posted by deanishe

  1. Remove this line. It's not correct. But it doesn't do anything anyway because the script finishes after the first return statement and that's the second one. You also don't need the set theQuery ... line because your script doesn't take any input from a previous action.
  2. No. Not when you use /usr/bin/python script.py "$1" in the Script box. A lot of developers have done it that way for years because it's better than pasting loads of code into the Script box. Now there's the External Script option, though. You can already do that by setting Language = /bin/bash and treating the Script box like a shell: PATH=/usr/local/bin:$PATH python3.8 myscript.py There are also ways to change the global environment Alfred uses if you really want to. But that can cause the problems Vítor mentioned, so Alfred actually takes steps to prevent you from doing that (it won't let you alter PATH in workflow variables) rather than making it easier.
  3. Change this to tell application id "com.runningwithcrayons.Alfred" to search "lp " so it will continue to work with Alfred 5+. Better yet, if it's appropriate for the workflow, change the workflow to run an External Trigger instead of calling itself by keyword. That's much more reliable (a user might have changed the keyword or be using "lp" for something else as well).
  4. Basically, you need to return a string with the title of a todo on each line. I don't have Things, but if you were getting the titles of every Safari tab, it would look like this: set _titles to "" tell application "Safari" repeat with _win in windows repeat with _tab in _win's tabs set _titles to _titles & (name of _tab as text) & "\n" end repeat end repeat end tell return _titles Put that in a Run Script (Language = /usr/bin/osascript (AS)) and connect it to your Random Utility with Random = "Word from list" and Words = "{query}".
  5. This is a completely different problem. It has nothing to do with Catalina. Please find the thread for the workflow you're having a problem with and ask in there.
  6. Yes, this is exactly how we are running the scripts, too.
  7. I believe Alfred strips snippet keywords when you install a new workflow, as it does with hotkeys, to prevent unexpected behaviour on the user's system. When you install a newer version of a workflow, Alfred preserves your own keywords and hotkeys, however.
  8. Right, got you. I doubt that regular expressions in snippet triggers will happen, as there's so much opportunity to mess things up. Like your example ;.*;. This is almost certainly incorrect, as it will match ;; (.* means "0 or more characters"), but more importantly, it also dangerous because it will match anything with two semicolons. Nobody wants Alfred to suddenly delete several lines of text from the email they're writing because it matched a poorly-written regular expression. The potential for causing problems is massive without very, very carefully written regexes. As such, it's extremely unlikely to be added. So I think you're best bet is to use what already exists: Snippet Triggers. Your defined snippet pops up Alfred's window, you enter your time expression in there (instead of inline), and then Alfred replaces the trigger text with the output of your workflow. My own Relative Dates workflow uses such a trigger to do something very similar to what you're aiming to do.
  9. There's good and bad to be said about it. Using /usr/bin/env python3 in my personal scripts means they'll continue to work on Catalina without my needing to install a Homebrew Python. OTOH, it also means they might die in flames if I'm in a virtual env. If you're distributing the software, it's also generally not a bad idea to lock it down to a specific interpreter, so you don't accidentally develop using a different version to all your users, and so the script isn't overly affected by some user's exotic environment, where /usr/bin/env python resolves to some stripped-down Miniconda (or indeed Python 3).
  10. Not really. Alfred uses the same env as everything else. Your shell uses its own env. If you want to use a non-standard Python interpreter, use its absolute path. Messing around with your global macOS environment is a bad idea because you'll end up publicly releasing a workflow that only runs on your system.
  11. Then you'll need to access the pasteboard yourself to retrieve the path. When you copy an image file, the OS puts a bunch of formats on the pasteboard, including the image data, its path, its URL and a text representation. The text representation, which is what Alfred passes to workflows because it can only pass text, is just the filename. The following JXA script should return the path of a file you've copied in Finder: ObjC.import('AppKit'); function run() { // Get file URL from pasteboard let url = ObjC.unwrap($.NSPasteboard.generalPasteboard.stringForType('public.file-url')); // Decode URI and strip file:// prefix return decodeURI(url).substring(7); }
  12. Ah, right. I'd never tried dragging a second window to a fullscreen desktop. Thanks. I know about this one. But that doesn't work when the app is already in fullscreen. And that's what you're asking how to do here. That's why I say the closest thing you're going to get is probably two resized normal windows. It's technically possible to automate all the clicking and dragging to put two apps side-by-side on a fullscreen desktop, but practically speaking, it's not going to work most of the time.
  13. No, I don't think so. As far as I can tell, Alfred's Open With menu keeps track of which applications you opened most recently (not necessarily via the menu) and shows the ones that declare that they can open the type of file currently selected. So the reason you're never seeing VS Code in the list is because the application doesn't declare to the system that it can open folders (even though it can). Personally, I'd much prefer Alfred to learn from how I use the Open With menu instead of trying to guess. The types of files an application can open doesn't have a lot to do with the types of files I actually open with it. I guess I should submit a feature request… What you can do with apps like VS Code is create your own File Action in a workflow that opens the selected files in the app. This is also faster, as the File Action shows up in the first list (i.e. you don't have to select Open With first).
  14. What zip package? You mean the source code? You don't. Install it via Homebrew.
  15. You can use duti to change the default handler for http/https. It's available via Homebrew. Should be very simple to build a workflow based on that.
  16. Yeah, the code that does the conversion could be pulled out and used in Alfred (or more generally, anywhere), but that is a browser script. With JavaScript, it's important to understand the difference between the language and the browser. Scripts aren't run the same way outside a browser, and a lot of common functions and APIs are provided by the browser, not JavaScript itself. The script uses a CSS selector target and document.getElementById() for all its input and output, but document and elements and CSS selectors are a part of the browser environment, not JavaScript itself. All Alfred scripts must follow the UNIX model, and use ARGV and STDOUT/STDERR for input and output because that's what's available in the environment the scripts are run in.
  17. To get a list of the UTIs known to the system, run the following in a shell: /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump | grep '[[:space:]]uti:' | awk '{ print $2 }' | sort | uniq
  18. Hi Torsten, welcome to the forum. This issue is usually caused by the simulated keypresses being too fast. Try a slower "Simulated key event speed" in Alfred Preferences > Features > Snippets > Auto Expansion Options > Tweaking:
  19. Andrea can't fix your stuff. What exactly are you trying to do? You want to launch Anaconda Navigator from Alfred?
  20. SearX has an API that returns search results. If you can find a reliable public node with the API turned on.
  21. I'm not sure what you're requesting here. Do you mean "Don't respond to my ↩ keypress until the Script Filter has finished executing with the query in Alfred's input field at the time I pressed ↩"?
  22. By preference, yes. I doubt I'll hardcode a particular command. Perhaps I'll add a generalised system for mapping arbitrary commands to modifiers. Alfred 4 has much improved support for modifiers.
  23. Debatable. You don’t need JavaScript analytics to know who’s using which browser. It’s not that Firefox support doesn’t matter, it’s that Firefox is almost impossible to support. A fairly simple JXA script can get the title and URL of the active tab from any common-ish browser that isn’t Firefox. But getting that info from Firefox is hellishly complicated and hacky because Mozilla doesn’t care about users like us. So if you want workflows that support Firefox, get on Mozilla’s case to make it possible.
×
×
  • Create New...