Jump to content

vitor

Staff
  • Posts

    8,522
  • Joined

  • Last visited

  • Days Won

    711

Everything posted by vitor

  1. Welcome @wjb, You need to use the API, the ChatGPT Plus subscription is something separate. See the FAQ for more information. If that’s not the issue, please provide the information requested under “How do I report an issue?”.
  2. I misread the second post at first, thought you hadn’t come up with something, and coded a quick idea. I’m curious to see what you came up with but since I already made it and it’s only an example and not a full workflow, I’m sharing it anyway for reference. The first thing I’d recommend is checking if you really need the full script to run in the background. It might be that you can get huge speed gains by making a section of it run in parallel. In an older version of Short Films, before the Grid View existed, the user’s machine would do all the processing of downloading thumbnail images then crop them. The first versions of this were slow and as part of the workflow I added a launchd agent to do the operation periodically¹. But then I backgrounded just the download and crop tasks and the speed boost was massive, to the point the agent wasn’t that important². I never investigated this thoroughly, but I bet the sequential web requests were the bottleneck. When you get a file from a server you’re not just waiting for the data to download, there’s also time taken to do a handshake and negotiate the secure connection. These add up. When sending each task to the background, multiple connections could start at the same time, reducing the delay³. But let’s say the code is already as fast as can be. Another approach is to use two objects (⤓ Example Workflow). You’re already having to save data and read it anyway, and Alfred objects can fork to any number of other objects, so there’s no reason you have to run the slow code and display the information in the same object. This has the added benefit that termination of your “view” object (the Script Filter) does not necessarily mean terminating the slow script, allowing you to quit and return later to see more data as it is available. ¹ An approach I still use with some workflows where you want the data to be cached even before you run the workflow. ² The current workflow doesn’t use it at all, but the approach in general is quite different. ³ If doing this today, I’d try to optimise it even further by having curl download every file in the same connection instead of creating multiple.
  3. See an earlier post on the thread.
  4. @maikfrank See discussion on GitHub. It‘s likely to be the same thing.
  5. Easier way is to use the Custom Argument in the Inbound Configuration and leave it empty.
  6. Your example JSON was quite clear, thank you. I have opened an internal issue for it.
  7. I did. I opened an issue internally to look into further. Regarding the copy, it’s reproducible only when filtering is off.
  8. Updated to 2024.1. Order reactions by usage.Remove reaction numbers from subtitle.
  9. Welcome @Maduranga, Seems like you want a Snippet Trigger which will do something, most likely via a Run Script Action since you want to query a URL, then use a Copy to Clipboard Output to paste. However, without knowing exactly what you’re trying to accomplish, it’s quite difficult to be more precise about the steps.
  10. Updated to 2024.4. Revamped imgur method. Includes method to view and delete uploaded images. Set custom folder to search screenshots.
  11. Updated to 2024.10. Make context window configurable.
  12. @Faris Najem Instead of trying to figure out what’s wrong with that script, figured I could instead add support for Text Replacements in the Snippet Transformer workflow. Try this preview version. Install it and run trimport.
  13. All thanks should go to @zeitlings, who created the workflow.
  14. The way to trigger something from another workflow would be the External Trigger.
  15. Did you set up the sync folder on the second computer? You have to do it in both.
  16. @Faris Najem That code is Python 2, and Python 3 broke quite a few things. Fortunately, this script seems simple enough that automatic conversion might be possible. Replace the contents of the script with the code below and try again. #!/usr/bin/python3 # encoding: utf-8 # # Copyright (c) 2020 Dean Jackson <deanishe@deanishe.net> # MIT Licence. See http://opensource.org/licenses/MIT # # Created on 2020-06-22 # Modified with 2to3 on 2024-05-01 """Convert macOS text shortcuts to Alfred snippets.""" from collections import namedtuple import csv from io import BytesIO import json import os from os.path import expanduser, join, realpath from subprocess import check_output import sys # directory to save snippets to SNIPPET_DIR = os.getenv('SNIPPET_DIR') or '.' COLLECTION_NAME = os.getenv('COLLECTION_NAME') or 'macOS' DBPATH = expanduser('~/Library/KeyboardServices/TextReplacements.db') QUERY = """ select ZUNIQUENAME, ZSHORTCUT, ZPHRASE from ZTEXTREPLACEMENTENTRY where ZWASDELETED = 0; """ Shortcut = namedtuple('Shortcut', 'uid keyword snippet') def log(s, *args, **kwargs): """Log to STDERR.""" if args: s = s % args elif kwargs: s = s % kwargs print(s, file=sys.stderr) def load_shortcuts(): """Read shortcuts from system SQLite database.""" output = check_output(['/usr/bin/sqlite3', '-csv', DBPATH, QUERY]) reader = csv.reader(BytesIO(output), delimiter=',', quotechar='"') shortcuts = [] for row in reader: if len(row) == 3: sc = Shortcut(*[s.decode('utf-8') for s in row]) if sc.keyword == sc.snippet: # ignore do-nothing shortcuts continue shortcuts.append(sc) return shortcuts def shortcut_to_snippet(shortcut): """Create Alfred snippet dict from macOS shortcut.""" return { 'alfredsnippet': { 'snippet': shortcut.snippet, 'uid': shortcut.uid, 'name': shortcut.keyword, 'keyword': shortcut.keyword, } } def safename(s): """Make filesystem-safe name.""" for c in ('/', ':'): s = s.replace(c, '-') return s def export_shortcuts(shortcuts, dirpath): """Save macOS shortcuts to directory as Alfred snippets.""" log('exporting snippets to %r ...', dirpath) if not os.path.exists(dirpath): os.makedirs(dirpath, 0o700) # remove existing snippets for name in os.listdir(dirpath): if name.endswith('.json'): os.unlink(os.path.join(dirpath, name)) for i, sc in enumerate(shortcuts): name = '%s [%s].json' % (safename(sc.keyword), sc.uid) path = join(dirpath, name.encode('utf-8')) log('[%d/%d] saving snippet %r to %r ...', i+1, len(shortcuts), sc.keyword, path) with open(path, 'wb') as fp: json.dump(shortcut_to_snippet(sc), fp, indent=2, separators=(',', ': ')) def main(): """Run script.""" shortcuts = load_shortcuts() log('loaded %d macOS shortcut(s)', len(shortcuts)) dirpath = realpath(expanduser(join(SNIPPET_DIR, COLLECTION_NAME))) export_shortcuts(shortcuts, dirpath) if __name__ == '__main__': main()
  17. Welcome @Tejush, That shouldn’t make a difference, as the workflow bundles its own version. If you modified something about it, you should remove it and install it again. Do note this particular workflow has been deprecated by the author. There is an official workflow which, amongst other things, returns the response as it’s returned from the API.
  18. Indeed, you can use {var:} in Automation Tasks. As to the original question, you can also use the Inbound Configuration to set a custom argument to the File Conditional, which can also be a {var:}. I just noticed that screenshot is outdated, though, as it doesn’t yet show the Custom Argument option. I’ll get that fixed.
  19. To add to the File Buffer you need to set "type": "file" or "type": "file:skipcheck", same as the Script Filter. I can’t reproduce the copy problem, it’s working fine in my test just now. Could you provide an example?
  20. Once you enter the Universal Actions panel, you’re effectively leaving the workflow and triggering something else, so there is nothing further downstream on that run. It might. Depends on what your Universal Actions take as input. Both. You can see them in the Universal Action preview after tabbing.
  21. Welcome @saulmunn, Every time that issue has happened, it has been some problem on macOS’ side. If removing Alfred completely from permissions (don’t just disable it) and adding it back didn’t work, reboot.
  22. Here’s a new version which let’s you set your own screenshots directory, plus it should fix the Imgur functionality and has new features to go along with that. But it does mean you’ll need your own Client ID. Instructions are in the workflow itself. Note functionality may change before the release version.
  23. You don’t need to reveal, use the Universal Actions.
  24. Welcome @Hekate, They are possible with the External Trigger and Call External Trigger Output. But as you noted, you should be very careful with how you handle them to not make something infinite.
×
×
  • Create New...