Jump to content

mihalski

Member
  • Posts

    9
  • Joined

  • Last visited

Everything posted by mihalski

  1. Wow. Talk about overcomplicating things for myself! If I had understood that Replace can work on SUBstrings as you've demonstrated then I would have not gone the regex way. Thank you! However, there are occasions where I would want to rearrange matched groups and then regex would be the solution? EDIT: Also, this would not handle variable whitespace on either side of the colon would it?
  2. I'm not sure I am doing this correctly (ie sharing my attempt at a workflow) but here goes: https://www.dropbox.com/s/6ke4abwe98rl15v/Clipboard Regex Substitute.alfredworkflow Alfred 4.0.1 macOS 10.14.5 I suspect I simply don't understand how information flows through the workflows.
  3. Oh I would absolutely streamline this (and try and figure out why the built in Replace didn't work) if I intended to use it consistently. As is it was only needed 128 times. Having said that, does anyone know what the problem with my original attempt to use regex with Replace was? I will certainly find uses for that if I can get it working.
  4. Thanks. You may notice that Copy to Clipboard is where I originally started. Does this mean I have to change the script so that it prints the desired string an output rather than putting it directly into the clipboard? That's my understanding.
  5. Literally pressing a keyboard combination of keys (ie a hotkey). ie. My desire is for me to press my hotkey, the script is run and then command-v gets triggered. One step process to paste the modified clipboard string.
  6. Thank you! That makes complete sense and works perfectly. Now is there any way to do an inverse hotkey? ie MY hotkey ctrl-command-v triggers the script and then a command-v to paste?
  7. The Run Script uses /usr/bin/python though when I want /usr/local/bin/python3. Or do I misunderstand how that works?
  8. I managed to get a half asses solution going. Using a hotkey I trigger a terminal command that consists of the following python script: #!/usr/bin/env python3 import re, pyperclip text = pyperclip.paste() result = re.sub("(^\\w+)(:\\s)([^\\0]+$)", r"\1 - \3", text) pyperclip.copy(result) This modifies the clipboard and readies it for pasting. Unfortunately it also opens up a terminal window. I wish I knew a way that this could all be done in the background without all the extra work, including the final paste.
  9. Hi, First post, first workflow I just purchased Alfred 4 on a whim because I had read up on it and a repetitive task happened to be annoying me. I wished to replace the occurrence of a colon in text from the clipboard when pasting. I loaded up the "Clipboard - Getting Started" workflow and stuck a Replace between the Clipboard Contents and Copy to Clipboard objects with Replace: regex (^\\w+)(:\\s)([^\\0]+$) with \1 - \3. This did not work so I also tried replacing with $1 - $3. No dice. Is there something fundamental I am misunderstanding here? I know the regex works and tested it on the suggested site and with other applications. Any help grateful appreciated! Regards, Michal
×
×
  • Create New...