Jump to content

tamaracks

Member
  • Posts

    3
  • Joined

  • Last visited

Everything posted by tamaracks

  1. Sorry, fumbled the submit button too soon. I was going to say: I think it would be hard to evaluate whether or not the entry is complete. The length would vary depending on what you wanted to convert. So, I don't expect to be able to make it perfect, just trying to make it a little more attractive. But some minimum number of characters that's not too high would probably help delay it a bit. I still think that I may also be able to tweak the bash script to return an alternate string if there's an error returned. Anything more elegant would probably have to be done in the Java library, and I don't know Java. The only "problem" with returning nothing on an error, as I currently have it, is that visually it makes the text in the Alfred jump around a bit based on whether there is a second line or not, which I find irksome. My husband is good with bash, so I'll ask him about that.
  2. Thanks for the tips. I think it would be hard to evaluate whether or not the entry is complete, at. The length would vary depending on what you wanted to convert. But some minimum number of characters that's not too high would probably help delay it a bit
  3. I had been using an extension in Alfred 1 that did conversions. I found it to be one of the most flexible extensions I found for doing conversions. It always knows what I mean. It is based on this java library: https://github.com/gnapse/metric The author of the java library originally posted the extension, but his blog is no longer online. I have been working on converting it to Alfred 2, though, and he said he didn't mind if I posted my workflow here for advice. It also does currency, but I discovered that sometime between when I began using the extension and now the provider of the currency info (OpenExchangeRates) had switched to requiring an App ID. So the versions of the workflow I'm going to post won't do currency conversion. However, I've found you can get a free App ID for personal use, so I've asked the author of the java library if he could add something that would let one pass an App ID so folks could sign up for their own. He said he would take a look. However that's not required for my question. The original extension simply called a brief bash script to pass your query to the java library and return a result to a notification. I first recreated that easily in an Alfred workflow: http://cl.ly/0J2f0A163y0Q Now I'm trying to make it return results in the Alfred window. I've actually got a version of it working already, but it could use some polishing: http://cl.ly/013j3V1L0P0X The trouble is how to handle the result when you are still typing. At first it returned errors in the Alfred window before your query was complete. Harmless, but ugly! The correct result will appear shortly after you finish typing. So far, I've managed to suppress the errors from going to stdout, so now it shows nothing for the second line if the library doesn't return a valid result. I haven't figured out how to put alternate text there, such as "Waiting for valid query" or some such. So I'm looking for advice on what I can do to provide the nicest output experience. It seems like Alfred starts calling the script shortly after you start typing following the keyword and continues to call it repeatedly as the typed query changes. As I see it, there are two options. Try to make a pause before the script kicks off, in hopes that you'd be done typing by the time it starts. However my concern is making it too long of a pause and slowing things down. Second would be to try to return some friendlier text instead of the errors. You might still get a valid result before you are finished typing. For example typing "15 g in pounds" might return "15 grams = 15 grams" if the script processes after you type the g, but it does update to the desired result when you finish typing. It's possible this is more of a bash question than an Alfred one, but I'd welcome any feedback/suggestions.
×
×
  • Create New...