dettogatto Posted June 22, 2016 Share Posted June 22, 2016 (edited) Since I love Ruby's fast syntax and ease of use maybe as much as I love Alfred, I decided to give Alfred the power to interpret Ruby, inspired by Altre's Python Interpreter. Ruby Interpreter also stores the last executed commands so you can re-use them and modify them later (set how much history you want to keep in Alfred Variables). Download from Packal Edited June 22, 2016 by dettogatto Link to comment
jyeakley Posted June 23, 2016 Share Posted June 23, 2016 Thanks for the cool tool. History seems to break right away when I try to use it though. Here is the error in debugger: [2016-06-23 09:48:59][ERROR: input.scriptfilter] XML Parse Error 'The operation couldn’t be completed. (NSXMLParserErrorDomain error 65.)'. Row (null), Col (null): 'attributes construct error' in XML: <?xml version="1.0"?> <items> <item arg="" valid="NO" type="text"> <title>Ruby</title> <subtitle>Write some valid code to execute it</subtitle> <subtitle mod="cmd">Write some valid code to execute it</subtitle> </item> <item valid="NO" type="text" autocomplete=""asdaD".reverse"> <title>"asdaD".reverse</title> <subtitle>History item: enter to use</subtitle> <subtitle mod="cmd">History item: enter to use</subtitle> <icon>icon_history.png</icon> </item> </items> Seems to be a parsing issue. Link to comment
deanishe Posted June 23, 2016 Share Posted June 23, 2016 Right here: <item valid="NO" type="text" autocomplete=""asdaD".reverse"> There are quotation marks within the quotation marks. It looks like the workflow doesn't use a real XML library, which it really should. The header is also suboptimal: <?xml version="1.0"?> Should be: <?xml version="1.0" encoding="utf-8"?> Otherwise the workflow will die in flames when given non-ASCII input. Link to comment
dettogatto Posted June 28, 2016 Author Share Posted June 28, 2016 (edited) Thank you for the feedback! Being new with Alfred every input that makes me learn something new is welcome! I didn't want to use XML libraries to avoid dependancies... I just found out that I already fixed the history issue, but, having some problems with PackAl, I wasn't able to update to the latest version. Try to update it now, everything should work, otherwise let me know! Edited June 28, 2016 by dettogatto Link to comment
deanishe Posted June 28, 2016 Share Posted June 28, 2016 I didn't want to use XML libraries to avoid dependancies... Unfortunately, generating valid XML isn't as simple as it looks. If you don't use a library, it's very likely that you/your users are going to keep running into issues with invalid XML, like the one above. Doesn't Ruby have an XML library built in? What about JSON? Alfred 3 understands JSON, too. Link to comment
dettogatto Posted June 29, 2016 Author Share Posted June 29, 2016 I followed your suggestions and updated my AWF to use REXML library (such a pain not to use Nokogiri to avoid dependancies!) Now you can use UTF-8 chars with no trouble (I hope) Thank you agin for your tips and feedback! deanishe 1 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