Jump to content

deanishe

Member
  • Posts

    8,759
  • Joined

  • Last visited

  • Days Won

    522

Everything posted by deanishe

  1. I'm afraid I don't know of an example. I generally avoid Node workflows due to the inevitable external dependency on Node. But npm defaults to local installations, so if you just use npm "normally", you can call your program with ./node_modules/.bin/program_name Re using /usr/local/bin/insect vs changing PATH, using a full path won't work if the shebang isn't also a full path. In that case, this should be sufficient: export PATH=$PATH:/usr/local/bin
  2. That seems an excessively complex solution. Can't you just use /usr/local/bin/insect? FWIW, whether or not your shell can find insect isn't super helpful. Alfred doesn't use your shell's environment. The best solution is to bundle the dependencies in your workflow. This isn't a perfect solution with Node-based workflows, as you still have to install Node, but the workflow will at least "Just Work" for people who have Node installed without them having to install an extra bunch of stuff just for your workflow. On every Mac they have. Also, installing dependencies globally is a fundamentally bad idea, and should be avoided if possible.
  3. Google Docs isn't the only target for which Alfred's longest delay is still too short (the same was reported for OneNote), so it might not be a bad idea for @Andrew to allow a longer delay.
  4. Use the correct escaping options (which Alfred defaults to when you create an empty Run Script action with Language = bash).
  5. Then Spotlight apparently doesn't like the volume. At this point, it's a macOS/Spotlight question, not an Alfred one. You'd be better off asking on Ask Different, where the folks who know this stuff are.
  6. If the volume exists, the command was probably a bit off. Try entering just /Volumes/ then hit TAB repeatedly till the right path is shown.
  7. Judging by the name, that isn't a native macOS volume (HDD formatted with HFS+ or an AFP-mounted share). AFAIK, they're the only types of volumes that macOS indexes. Does Spotlight find anything on that volume? If not, you might be able to enable indexing via Terminal with mdutil -i on "/Volumes/GDrive - JayRay"
  8. You probably just need to reload Alfred's application cache with the keyword "reload". Alfred treats apps a little differently, and keeps its own index of them.
  9. You've misunderstood a couple of things. Spotlight's Search Results tab configures exactly that: Spotlight's (not Alfred's) search results. It doesn't affect what is actually indexed. If you don't want a certain folder to be indexed at all, add it to the Privacy tab. That will also prevent its contents from showing up in Alfred and any other applications that use the system index. Since many (most?) applications that have a search function use the system's indexing API to search their own data, you should be careful what you add here, e.g. if you add ~/Library, you're going to break the search function in a lot of applications. Adjusting the scope and file types in Alfred Preferences only affects Alfred's default search (i.e. without a keyword). Using find or open searches the entire index regardless of what you've configured in Alfred Preferences. The best way to use Alfred is to keep the default search restricted to relatively few folders and filetypes, and create additional, fairly-specific searches using File Filters. For example, you might create a search for only one folder or for only Excel files. That keeps searches fast and results relevant. find and open are sort of "fallbacks", as they use the entire index, which as you've noticed, contains a lot of stuff you're not interested in.
  10. No idea, I'm afraid. This workflow is profile aware. Might be worth a look.
  11. How does it handle multiple Chrome user profiles? I mean, does Alfred always load the bookmarks for the default profile, the active profile, all profiles?
  12. @Vero already told you how to fix that. If you create the folder /Users/eibrahim/Library/Application Support/Alfred 2/Workflow Data, many old workflows will still work. Alfred itself doesn't care where workflows keep their data. The problem is that a lot of workflows expect the above directory to already exist. It might also be a good idea to install this workflow. It will fix a lot of older workflows that don't work properly on Sierra. Ultimately, a lot of workflows were written when Alfred 2 was young and never updated again, so they require a small amount of work to get them functioning under Alfred 3. For any workflows that aren't fixed by doing one or both of the above, your best bet is to seek out their GitHub repo or forum thread for information/help. The chances of the author seeing this thread are low.
  13. Sorry. I was half-awake and misread your question. No. But this script does what you want: tell application "Sublime Text" if it is running then tell application "System Events" tell process "Sublime Text" to click menu item "New Window" in menu "File" of menu bar 1 end tell end if end tell -- Activate doesn't work with Sublime on Sierra do shell script "open -a 'Sublime Text'"
  14. The answer to your question is a few posts above yours.
  15. If you already have a workflow, even a non-working one, could you upload that somewhere and post a link?
  16. So you want to paste the binary GIF data? If you want to put data in an arbitrary input field, you're pasting it.
  17. So you want a workflow that searches the Giphy API and copies the URL, optionally also pasting it to the active application? Images aren't text. To be clear, you mean the URL of an image?
  18. Why do you need a workflow? Why doesn't a simple File Filter work? "Input field" where? In a browser? A Mac app? A text field? A file (upload) field? What do you mean by "export"?
  19. I deliberately left the "shebang" comment as an exercise for the reader (I didn't want to get into the details of UNIX scripting). Now we've gone there, I guess we need to mention that Alfred runs your scripts in its own, empty environment, not your shell's.
  20. @GuiB gave some solutions, but didn't explain what the root cause of the problem is. (Excuse me if this explanation comes across as for-idiots or patronising: I'm aiming to explain this just once and link to it in future, so I'm writing this for total noobs.) macOS is basically a UNIX system with Cool Apple Shit layered on top. Alfred itself exists in the Cool Apple Shit layer, but workflows are at the lower UNIX level. This means they must, essentially, be UNIX programs. As such, an External Script element can only run a UNIX executable, which is to say something you can run from a shell. Concretely, that means the execute bit must be set (run chmod +x /path/to/script in a shell), but also that it must be a UNIX program or a script with a shebang. AppleScript, as the name implies, belongs to the higher Cool Apple Shit layer (though AppleScript is pretty damn far from cool), and as a result you can't run it directly via the UNIX subsystem. Fortunately, Apple has written a bunch of programs to access the Cool Apple Shit from the underlying UNIX layer. As @GuiB explained, the one you need to run AppleScript scripts from the UNIX layer is osascript. But there are other super-cool ones, like security, which provides access to the macOS Keychain, and mdfind, which lets you run Spotlight queries from the command line/scripts/workflows.
  21. Right, sorry. I figured you were talking about results from running as script, as Alfred always re-populates its own results instantly for me. That said, I don't use it as heavily as you, so perhaps I'm just not noticing the odd delay. I'd agree that caching the results along with the last query would be a good idea. Alfred should still perform the query again, imo, and update the results if something has changed. Same as happens with rerun in a Script Filter.
  22. I don't think that's a good solution. It might work for some workflows, but with others, the results are effectively invalid as soon as a result is actioned or Alfred closed (e.g. a workflow that shows and/or does something with Safari tabs). As such, it would have to be a Script Filter-level option. Even then, it still might lead to unexpected behaviour, as Alfred doesn't have the context your script has to know whether the old results are still valid (e.g. the user has edited whichever data the workflow is using). IMO, your script is a better place for the result-caching to be performed. In a language like Ruby, it's pretty simple to implement a wrapper function that caches data for X seconds.
  23. I use CryptoCompare in my unit conversion workflow. Not sure if it meets your needs, but it supports a helluva lot of cryptocurrencies. https://www.cryptocompare.com/
×
×
  • Create New...