Jump to content

avk_tp

Member
  • Posts

    50
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by avk_tp

  1. Just a small *bump* as I can't seem to sort this.
  2. Thanks for the response. I'm not certain how to go about designing it exactly as you said, but I did incorporate isset into the script using an if statement. Unfortunately the whole thing works only if all of the pieces exist; as soon as one is missing, it fails. I'm guessing it's because the isset if statement is listed within a foreach loop, so I tried included an "else, break" style statement, but with no success - it continues to work if all pieces exist, otherwise it fails. In case that's unclear, here's one of the loops: I tried putting the final "endforeach" before the else statement as well, but that just causes the whole thing to fail regardless of whether the different pieces all exist. I'm not sure if I'm making a minor syntax error or if the structure must be changed if I want to use isset in this way. I also tried constructing the relevant if statement with reference to a variable created using the count function, which had the same partial failures as the isset approach. Thanks again for the help.
  3. Sorry, I lack the correct terminology to explain the problem quickly. Basically, I have Alfred returning inline dictionary results, from a subheading (?) that's labeled "PrincipalTranslation" - which in most instances is where the relevant results are listed. However, I recently noticed that results that exist on the website I'm pulling everything from are sometimes not returned in Alfred at all; this is occurring in instances where there is no "PrincipalTranslation" category, but rather one labelled "Entries". In case this is unclear, here is the typical way results are presented (which returns inline results without any issues): http://api.wordreference.com/0.8/80186/json/fren/chien. And here is the alternative way: http://api.wordreference.com/0.8/80186/json/fren/fouir So what I want to do is alter my script to have Alfred list inline results first for the "PrincipalTranslation" category and then for the "Entries" category, so that it won't miss out on dictionary entries in instances where translations exist but aren't labeled "PrincipalTranslation". That's what led me to take the approaches I mentioned above. Does that make sense? Just let me know if you need any further clarifications.
  4. I think this will be an easily rectifiable bug, but I haven't been able to sort it out myself. I need to change the line to also somehow incorporate the source since sometimes the only available info is under "Entries" rather than "PrincipalTranslations". I tried doubling up the foreach loops (repeating the relevant part of the script twice), but despite the fact that both loops work on their own, when I put one after the other it just stalls for awhile and then fails. I also tried inserting an if statement with the following approach: but there I think I'm making a syntax error that I don't know how to overcome. For reference, here's the whole script: Thanks so much for all your help.
  5. Update: WordReference is no longer accepting new registrations for API keys, but those who have already registered can continue to use them. As such, new users won't be able to set this up. --- For the language learners among us, here's a workflow that returns results from http://wordreference.com into Alfred. As you can see from the screenshot, you'll get various definitions in the original language (designated using the relevant flag), with each definition proceeded by translations in the target language (parts of speech and the gender of nouns (where applicable) are also included). Pressing enter will take you to the entry page on wordreference.com. Numerous dictionaries are included (I can add additional ones carried by the WordReference website if there are any requests), with the specific dictionary called up using the first two letters of the original language followed by the first two letters of the target language. That means: enfr: English to French fren: French to English enit: English to Italian iten: Italian to English enes: English to Spanish esen: Spanish to English pten: Portuguese to English enpt: English to Portuguese In addition, typing frc, itc or esc, followed by a verb (in French, Italian or Spanish respectively) and then pressing enter will call up (in your browser) the conjugation table for the verb. For example: Lastly, note that in order to use the workflow you must first register for an API with wordreference.com (this is necessary to prevent excessive calls from any given API). That can be done by using the 'getapi' keyword in Alfred, or using this link: http://www.wordreference.com/docs/APIregistration.aspx. You then set the API by using the 'setapi' keyword. And just in case you "tl:dr" that: DOWNLOAD (Version 0.6 - 07/05/13) Updates will be released via Alleyoop 2 and posted here. Let me know if you've got any feedback. Also, thanks to everyone in the help forums who helped me overcome my near total inability to code.
  6. You're totally right: I should've left the space out to create an empty string. Unfortunately it doesn't resolve the issue, however, as Alfred still changes the order. I also tried declaring the uid without setting any value whatsoever, but that didn't correct the problem either. For some reason only generating a random variable seems to work.
  7. Thanks so much. I had been trying to get the uid to be empty as per Carlos' suggestion (the best I could come up with was setting it to "' '", which only fixed the problem temporarily), but generating a random number for it instead was comparatively easy to figure out. This seems to have fixed the problem, even with me purposefully trying to throw the ordering out of whack. Thanks everyone!
  8. Thanks for the feedback, but that leads me to another question: how would I go about leaving the UID empty in my PHP script? Is it a simple fix or do I have to restructure the script? I'm not an actual programmer so I'm really groping through the dark with this. Thanks in advance for the help! ETA: Just in case it's necessary for knowing the right approach, the results the website sends look like this:
  9. Howdy, I just noticed a bug in an otherwise completed workflow that provides dictionary-based translations: the last element in the list keeps being placed first in the inline results. This is problematic since the first line provides the original language definition, which is then followed by lines presenting the target language translation; as such, the results are confusing if they're out of order. I've attempted a few small workarounds that seem to fix the problem temporarily (and lead me to believe I have it sorted), only to have the issue return after a small period of time. I'm not sure if it's a problem with the source website or what, but here's the code (it first checks to see if the API has already been entered by the user, then returns the translations if it has): Can anybody see what I'm doing wrong? Thanks so much for your help, Anthony
  10. Downloading it directly from your blog fixed the problem! I'm almost certain I didn't modify the workflows.php, but although the version I had was 0.3, it was missing the "save values to a specified plist" section. I probably originally copy/pasted the file from another workflow (most likely the urban dictionary one that I used as my example for the script). Thanks so much for the help!
  11. I added the line, but the error persists: Thanks again for the help.
  12. Thanks for the help, guys. As in the wolfram|alpha workflow, first up I've got a script filter (which seems to work fine): Then I run a script, which I think is where the problem is: Attempting to set the api key, I get a fatal error: My best guess is that the problem has something to do with 'settings.plist'. I don't see it in the wolfram|alpha workflow folder, and so I have no variant of it in my folder either (I've obviously got 'info.plist' in there though). Any ideas?
  13. Hello, I've got a translation workflow up and running, but the website limits the number of requests per hour per API key. As such, while I could put out the workflow as is, I was wondering if there's a relatively simple way of prompting the user to get and enter their own. I tried using the Wolfram|Alpha workflow as my example, but I couldn't get it to work. I'm hoping that someone knows of another (simpler) example I could try to replicate, given that I'm not actually a programmer. Thanks very much, Anthony
  14. Hey hey, I was having the same issue. I got around it by having the openinchrome workflow also open up chrome when I go to use it (see below). With this method, if chrome is already open it just adds an extra tab, whereas if it's not it opens up a new window. The only slight glitch is that in the latter case it opens up an extra tab as well, but it's not a real problem unless you're a perfectionist.
  15. I downloaded GrowlVoice to get it working, but I then realised that it's only integrated with the American service (Google Voice) and not the internationally available one (Google Talk... I always mix up their names). As such, I'm afraid we'll need an American to test it while I wait for either the service to be extended internationally or GrowlVoice to add Google Talk support. Sorry about that!
  16. I'm not sure if it's just me, but this workflow has stopped working for me. I tried reinstalling it but to no avail.
  17. I've attempted to create a workflow providing inline translation results from wordreference.com, but my very limited skills have thwarted me. The website does offer API keys (http://www.wordreference.com/docs/api.aspx), which seems to be key for this kind of thing, so I was wondering if someone might be able to help me out with this one. I've noticed a couple of requests from other people on threads for translation workflows, so I think this could be very useful to more than just me. I'm personally interested in English/French and English/Italian translations, but based on the setup of the wordreference website I think it would be pretty easy to switch around the exact translations being provided. Thanks so much in advance!
  18. There are a couple, but GrowlVoice is probably the most common. There's also a Chrome extension that does the same thing (and is free), but I don't imagine that would work for a workflow.
  19. Thanks for the tip, but unfortunately there must be other issues since it's still not working. I tried fiddling with it a bit more as well, but can't seem to get it up and running on my own.
  20. Hello, I've been trying to figure out how to create a wordreference.com workflow with inline results. Right now I'm using a simple workflow that opens the relevant translation page in a browser, but my feeble attempt to create a more advanced version by adapting the UrbanDictionary workflow (and then fiddling with the result) is not working. Wordreference.com does offer API keys (http://www.wordreference.com/docs/api.aspx), which seems to be important for this kind of thing, so I think it should be possible for a person who actually knows what they're doing. For what little it's worth, here's my current attempt, totally just adapted from the Danylo Kostyshyn's UrbanDictionary workflow: That version's attempting to translate French to English, but I'd like to also access English to French and English/Italian translations. Thanks very much in advance for your help!
×
×
  • Create New...