Jump to content

dfay

Member
  • Content Count

    863
  • Joined

  • Last visited

  • Days Won

    44

Everything posted by dfay

  1. I never needed this until now, but I'm thrilled to see there's a working Alfred-based solution
  2. I’d recommend sips https://robservatory.com/use-sips-to-quickly-easily-and-freely-convert-image-files/ See especially the last link there.
  3. No. I use Drafts for iOS for almost all the same custom web searches I have in Alfred, but there’s no direct equivalent.
  4. TextExpander (legacy) is what they renamed TE Touch to be. Here's the setup in Hazel: this assumes anything you don't want to sync is tagged notForTE Rule 1. for your Alfred snippets folder: Rule 2. (same location) with the embedded script set to the first line here (I also sync to Copied, but I'll just cover TE for now) -- replacing the squiggles with the correct path to the script below: AlftoTE.py you'll need to specify the TE group where you want the synced snippets to appear and add the uuid to the script. I just created a new TE group for sync purposes, then went to Settings.textexpandersettings > Show Package Contents and found the new group file there. The uuid is just the group file e.g. group_E65531A8-88BA-4619-B5D1-B954AC3DC0FF_4733813705.xml without the group_ at the beginning and the .xml at the end e.g. E65531A8-88BA-4619-B5D1-B954AC3DC0FF_4733813705 #!/usr/bin/python import argparse # from plistlib import readPlist, writePlist - no longer writing TE plists directly import json import os import uuid from datetime import datetime # UUID for target group for new snippets in TextExpander teTargetGroup = "your uuid goes here" def get_te(abbreviation=None, plain_text=None, label=None): return { 'abbreviation': abbreviation, 'abbreviationMode': 0, 'creationDate': datetime.now(), 'label': label, 'modificationDate': datetime.now(), 'plainText': plain_text, 'snippetType': 0, 'uuidString': str(uuid.uuid4()).upper() } def a2te_replacements(s): s['snippet']=s['snippet'].replace('{clipboard}','%clipboard') s['snippet']=s['snippet'].replace('{cursor}','%|') # in theory this should be extensible to handle date formats and date math... return s def transform(direction, source): if direction == 'AlftoTE': source = source['alfredsnippet'] source = a2te_replacements(source) return get_te(abbreviation=source['keyword'], plain_text=source['snippet'], label=source['name']) else: raise Exception('Unsupported direction') if __name__ == '__main__': parser = argparse.ArgumentParser(description='Alfred-Expander Sync') parser.add_argument('direction', choices=['AlftoTE'], default='AlftoTE') parser.add_argument('--alf', default=None, help='Alfred json snippet') args = parser.parse_args() source = args.alf with open(source, 'rb') as source_fp: source_json = json.load(source_fp) s = transform(args.direction, source_json) # use TE AppleScript rather than modify plist directly cmd = """osascript -e 'tell application "TextExpander" set g to every group whose ID is \"""" + teTargetGroup + """\" tell item 1 of g make new snippet with properties {plain text expansion:"""+"\""+s['plainText']+"\","+"abbreviation:"+"\""+s['abbreviation']+"\",label:\""+s['label']+"\"}"+""" end tell end tell'""" os.system(cmd) Incidentally the argument parser is completely unnecessary since there's only one option, but it's a legacy from having used this to get started: https://github.com/markphilpot/sync_expanders
  5. Or to continue with AS, look at the examples here: This is what I used to figure out how to do the recent folders and active folders scripts in And here's a solution for you: set theList to {"Red", "Green", "Blue"} # What next? -- import JSON library set workflowFolder to do shell script "pwd" set json to load script POSIX file (workflowFolder & "/json.scpt") -- Create and add items set theItems to {} repeat with i from 1 to count theList set end of theItems to json's createDictWith({{"title", (item i of theList) as text}, {"uid", i},{"arg", (item i of theList) as text}, {"subtitle", "Same Words " & (item i of theList) as text}}) end repeat -- Create root items object and encode to JSON set itemDict to json's createDict() itemDict's setkv("items", theItems) return json's encode(itemDict)
  6. Sure, but it might take me a week or two before I can get it written up. Feel free to nag me.
  7. Is there any chance Alfred could be set to dump the clipboard contents in json somewhere as well? I’d love to be able to pull them in from Dropbox in an ios shortcut.
  8. If you search forums for finder window this is the fourth hit & does what you’re looking for
  9. That’s not likely to help - the underlying problem is a Spotlight issue. I’d avoid using root for anything not absolutely necessary.
  10. If I'm not mistaken the pull down menu is what's referred to in AppleScript as a pop up - the Keynote script above uses this code to select a preset from the same kind of menu: set thePopUp to first pop up button of sheet 1 of window 1 whose description is "Presets" click thePopUp click menu item "6x" of menu 1 of thePopUp
  11. UI scripting can be done in AppleScript (and I think it will be the same process for Alfred and KM, but I don't use KM) -- but it does tend to be fragile. see this for an example that still works after six years, with a print sheet (i.e. same kind of element you're looking at) https://github.com/derickfay/keynote-to-pdf I was only able to create this by using the script here to identify the UI elements: http://hints.macworld.com/article.php?story=20111208191312748 see also the resources in this thread:
  12. right - I get that - just saying that there's another way to find the exact keyword or name that you can then enter in the prefs
  13. Couldn't you make an alias to a folder full of snippets that only exists on one computer, & stick that in the synced snippet folder? update: nope, that won't work as the Alfred Preferences don't seem to resolve aliases....
  14. Note that if you use the snip keyword it does give partial matches. Not the same but it should make it easy enough to find what you're looking for in most cases.
  15. I've moved all my snippets from TextExpander to Alfred, and it's actually pretty easy to create the equivalent of a nested snippet using snippet triggers in a workflow . Not as simple as in TE but easy to do if you don't anticipate continuously creating a lot of new ones (which is still easy but a bit of work.) Here's an example: https://www.dropbox.com/s/xu8afkqd4hfzgn2/nested snippets.alfredworkflow?dl=0 The snippet values are stored as environment variables and the first two snippet triggers show how to use them. The third shows how to use a list filter to replace the address value on the fly.
  16. Yeah i’m in the exact same situation. No rush at all.
  17. I suspect this is unfortunately the issue: ”macOS 10.15 Catalina bans third-party applications from searching the Mail.app Spotlight index. On macOS Catalina, HoudahSpot will thus no longer be able to find your Apple Mail messages.” From https://blog.houdah.com/2019/07/is-houdahspot-optimized-for-upcoming-versions-of-macos/
  18. I don't, was just being lazy. Updated to actually parse the query rather than sticking it in a list and hoping for the best.
  19. I was focused on speed of entry hence the fixed folder. Otherwise there’s either a fourth string to include in the text or an additional entry box. By that point you might as well open preferences and do it natively. It might be possible with a file filter, though - let me look.
  20. Just figure out why you can't drag these. As hinted at (but not really explained) here the draggable area is only the border padding. Which is set to as small as possible in these - which makes them look so good imho. But it also makes them almost impossible to drag (there's actually a tiny square in the top left where you can drag...). @Andrew could you consider allowing some other theme elements to work as drag handles?
  21. These are in the environment variables for the workflow. You can set them through the GUI without editing the script - you click the [x] icon in the top right of the workflow screen, and a panel will drop down where you can set them. I believe the devs recommend against using iCloud Drive for Alfred's preferences. But in any case you should be able to go to your Alfred.alfredpreferences file location (as set up in Settings > Advanced > Syncing > Set preferences folder... ) then add /snippets/ to the end of that path.
×
×
  • Create New...