sönke Posted January 25 Posted January 25 (edited) I would like to have a workflow that deletes everything back to the last period. example: The dog is outside.; he doesn't want to come inside. he's a good workflow desired outcome: The dog is outside.; he doesn't want to come inside. --- Does someone know if that would be possible? I tried to find the correct regex expression, that highlights text (^.!?]*\s*$) but I am not even sure if that is possible in theory. (Alfred 5, PowerPack) Thanks! Edited January 25 by sönke
giovanni Posted January 25 Posted January 25 if you are OK with using Python, this will work: import sys s = sys.argv[1] s = s.rsplit('.', 1)[0] + '. ' print (s,end='') sönke 1
sönke Posted January 26 Author Posted January 26 Thanks @giovanni I put this into the Run-Script. Would I have to download Xcode for this to work? It takes a huge amount of space on my disk. (sorry for the noob questions) Debugger: [07:47:06.406] asdf[Hotkey] Processing complete [07:47:06.416] asdf[Hotkey] Passing output '' to Run Script [07:47:06.420] ERROR: asdf[Run Script] xcode-select: note: No developer tools were found, requesting install. If developer tools are located at a non-default location on disk, use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, and cancel the installation dialog. See `man xcode-select` for more details.
Stephen_C Posted January 26 Posted January 26 You probably just need to install the Apple command line tools (or reinstall them if an update has messed up the installation): see, for example, this post and others following in the same thread. Stephen
sönke Posted January 26 Author Posted January 26 Thanks @Stephen_C that worked. Now I have a different error with the python script. [11:10:24.503] asdf[Hotkey] Processing complete [11:10:24.521] asdf[Hotkey] Passing output '' to Run Script [11:10:24.609] ERROR: asdf[Run Script] Traceback (most recent call last): File "/Users/sonkewindhausen/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/721A6D20-D70D-41CB-83A7-6DA6E91B96EF", line 2, in <module> s = sys.argv[1] IndexError: list index out of range I am not sure if it is possible even in theory. I would like to use this workflow while writing and having a hotkey quickly delete everything until the last period. Grateful for any help thanks guys
giovanni Posted January 26 Posted January 26 12 minutes ago, sönke said: I would like to use this workflow while writing I added this function to a workflow I made in the past. install the workflow, then: select the text you want to edit open Universal Actions (default hotkey: ^ ⌘ \) find Delete text after last period press ↩️. the text will be replaced with the new text or, if you can't write in the current app, will be in the clipboard
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now