Jump to content

Text Tools (append, prepend, create, search)


Recommended Posts

Here's a workflow I use to work with text files (which for me live in Dropbox, but that's not a requirement).

 

It has these features:
 
  • Create a new text file
    Query: create {folder to create the file in}, followed by the filename in the resulting dialog
  • Search across existing text files
    Query: grep {search query}
  • Append a line to an existing text file
    Query: append {file to append to}, followed by text to append in dialog
  • Prepend a line to an existing text file
    Query: prepend {file to prepend to}, followed by text to append in dialog
     

Screen%20Shot%202013-09-24%20at%2011.36.

Screen%20Shot%202013-09-24%20at%2011.45.

More at http://matthewhealy.net/blog/category/text-tools-for-alfred. I'd love to hear feedback and suggestions.

 

 

Link to comment
  • 5 months later...

Great workflow. I like to keep a log using the prepend command, but I'd like to add a line between entries. How would I modify the script to do so?

 

No need to modify the script! You can just use the \n command. So when you put the text in the prompt, just do "\nThis is the text I would like to append"

 

 

Looks interesting, but it sends me to my browser every time. I have modified it according to your instructions but without success.

 

I was running into that same problem, until I realized the files I had were Rich Text Files and not Plain Text. Once I converted the files, this extension worked perfectly. Have you checked to make sure your files are .txt ?

Link to comment
  • 10 months later...

An awesome workflow ! Thanks for sharing !

 

About the sf command (grep)

It is a little bit confusing to read "Search Text files in Dropbox" while the default folder is set to the Downloads folder. 

-> I thought the workflow was not working, or I was too stupid to make it work ;), as the query I tested didn't return anything.

Link to comment
  • 1 year later...

Hello! I'm reposting this discussion from twitter so it's more easily searchable for others:

 

Hey! Your Alfred Text scripts are great (really great!) but I'm having an error on MacOS Sierra 10.12.1 and Alfred 3.1.1.

 

The "Create File" workflow won't launch in the default top-level folder, which I've set to "~/Dropbox/PlainText" as you have.

 

It _will_ open sub-folders, for example `~/Dropbox/PlainText/old`.

 

Per the author:

 

"Yeah the problem is it doesn’t ever get to the AppleScript because there are no results from the file filter".

 

Any help would be appreciated!

Link to comment
  • 1 year later...

I recently discovered Matthew Healy's Text Tools for Alfred. They really help me, with the exception of the Create script. This fails for reasons I do not understand. Debug has this error:

 

[2018-01-29 14:53:32][ERROR: input.scriptfilter] Code 1: Traceback (most recent call last):
  File "pygrep.py", line 25, in <module>
    fb.add_item(repr(tokens[1])[1:-1], tokens[0], tokens[0])
IndexError: list index out of range

 

I guess there must be something I need to update. I am on High Sierra with latest Alfred and PowerPack.

 

Thanks

 

Jeremy 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...