Awfki Posted December 13, 2016 Share Posted December 13, 2016 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
deanishe Posted December 14, 2016 Share Posted December 14, 2016 Download a collection of Alfred snippets and look at the file. It's a ZIP file containing one JSON file per snippet. Build one of those and you can import your snippets all at once. Link to comment
Awfki Posted December 14, 2016 Author Share Posted December 14, 2016 (edited) 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 December 14, 2016 by Awfki Link to comment
deanishe Posted December 14, 2016 Share Posted December 14, 2016 (edited) 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 December 14, 2016 by deanishe Link to comment
Awfki Posted December 16, 2016 Author Share Posted December 16, 2016 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. dfay and deanishe 2 Link to comment
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