Jump to content
evanfuchs

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

Share this post


Link to post

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

Share this post


Link to post

well,

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

 

(tested with BBedit and it works)

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...