Jump to content

Mass Create Snippets


Awfki

Recommended Posts

I have 708 little text bits that I want to menu-ize.  If I can make each one a Snippet and stuff them all in a collection that seems like one way to do it. Except I'm not seeing a way to mass import from a text file.

 

Can it be done (without huge effort)?

 

If not, are there other options?

 

 

PS.  The snippets are HipChat emoticons like (congaparrot).

Link to comment

I looked at that and it looks like a major PITA and one of the reasons I think JSON is an abomination.  One comma out of place and 30 minutes of your life are gone.

 

Why don't we use CSV and XML any more?  Those are easy to work with.  Or at least they're easy for humans to read and manipulate.

 

And really, one file per snippet?

 

Okay, so it can be done but there's no good solution.

 

Thank you

Edited by Awfki
Link to comment
5 hours ago, Awfki said:

Okay, so it can be done but there's no good solution.

 

That depends on whether you can automate the conversion with a bit of scripting or not…

 

5 hours ago, Awfki said:

I think JSON is an abomination.  One comma out of place and 30 minutes of your life are gone.

 

Why don't we use CSV and XML any more?

 

JSON isn't for humans, it's for computers. As such, it can be a lot easier to work with than CSV/XML because JSON data types map very closely to standard types in programming languages.

 

Edited by deanishe
Link to comment

Googling alfred json snippet turned up this python script which worked wonderfully.

 

The script works in Python 2.7, didn't work with Python 3.5.  After formatting your CSV and running the script you'll have a bunch of .json files.  Zip all those up and name the file Collection.alfredsnippets and then open the file (cmd-down arrow).  Alfred will import the snippets into "Collection" (you can name that whatever you'd like) and WILL OVERWRITE IT if it already exists.

 

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