Jump to content

display/copy lines from text file


Recommended Posts

I have a text file with phrases listed alphabetically, one per line. I'd like Alfred to display the lines in the ordered list and be able to copy the selected line to the clipboard. The list changes, so it would need to be read from the file or updated daily/manually.

 

I've read some posts that may be close, but they are over my head so I'm pretty much lost. Can this be done without mad skills?

 

Thanks

Link to comment

Yes I found that after this post, which is fantastic. Thank you. I’d love to automate the process of converting my single column file:

 

alpha

beta

gamma

 

into three columns format to make Alfred happy:

 

alpha, ,alpha

beta, ,beta

gamma, , gamma

 

Thanks again. That list filter workflow is awesome. 

Edited by evanfuchs
Link to comment
3 hours ago, juliosecco said:

using BBedit or another text editor thst accepts regular expressions, you could do a search replace  this way:

 

search string: ^([^\n]+)$

replace string: \1,,\1

 

Thanks. I can do it manually in Excel pretty easily, but I think regular expression replacement/substitution is the right track for a script/workflow solution. I just don't know how, but I'm trying to learn.

Link to comment
On 8/29/2018 at 3:04 AM, evanfuchs said:

I’d love to automate the process of converting my single column file:

 

alpha

beta

gamma

 

into three columns format to make Alfred happy:

 

alpha, ,alpha

beta, ,beta

gamma, , gamma

 

Hi,

 

I have never used python , but I have arranged a little update to the fuzzylist.py script.

 

at line 25 you can see a line like this:

 

        r['uid']=r['arg']

 

now you should insert two new lines before it:

 

        r['arg']=r['title']
        r['subtitle']=""

 

the first command will set the 'arg' (the value that will be pasted if you attach a 'Copy to clipboard' action to the Script filter) in the output json file with the same value of the 'title'

the second command simply sets 'subtitle' to empty. so you don't see <null>

 

with this update  the list.csv file to drag into the workflow folder does not need anymore to be a three column text file but can be a single column file, with the single column value assigned both to the 'title', 'uid' and 'arg' values of the created json file.

 

hope this helps you,

 

Giulio

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...