Jump to content

Currency Converter workflow with natural language support


Recommended Posts

Hi everybody,

 

I've created a simple but (i hope) useful currency converter; this workflow support simple and complex queries like:

 

  • currency € -- Current EUR/USD exchange
  • currency € £ -- Current EUR/GBP exchange
  • currency 12 € -- Convert 12 EUR to USD
  • currency 12€ £ -- Convert 12 EUR to GBP
  • currency 12 € £ -- Convert 12 EUR to GBP
  • currency 12 EUR £ -- Convert 12 EUR to GBP
  • currency 12 EUR to £ -- Convert 12 EUR to GBP
  • currency from 12 € to GBP -- Convert 12 EUR to GBP
  • currency to GBP from 3€ -- Convert 3 EUR to GBP
  • currency to GBP 3€ -- Convert 3 EUR to GBP
125p63a.jpg
 

 

Link to comment

Hi, 

 

Just started using your workflow, awesome stuff! I just have one problem with it, when I try to type 'currency' (or my current shortcut curr) quickly I do get sometimes the 'currency-set-to' instead of the converter. Is there some way that you can mark 'currency' in the code as the 'main' action? Or maybe this is a good suggestion for the alfred V2 workflow code?

Link to comment
  • 2 weeks later...

Otherwise great, but the default currency feature doesn't really work. If I set my default to currency to EUR, it converts USD into EUR without any additional parameters, but when I try any other currency (GBP, JPY), it automatically converts it to USD instead of EUR.

Link to comment
  • 1 month later...

Otherwise great, but the default currency feature doesn't really work. If I set my default to currency to EUR, it converts USD into EUR without any additional parameters, but when I try any other currency (GBP, JPY), it automatically converts it to USD instead of EUR.

 

That's also bothering me a bit, even though the workflow is really nice. I'm trying to dig through the code but it seems I'm not pro enough for this one..  :wacko:

Link to comment
  • 2 weeks later...

Like this workflow as well, but the default currency was bothering me as well. The problem appears to lie on line 129 of e4QueryParser.php in libs.

 

Change this from:-

 

$this->to = $this->from->isEqualOf($this->defaultFrom) ? $this->defaultTo : $this->defaultFrom;

 

to:-

 

$this->to = $this->from->isEqualOf($this->defaultTo) ? $this->defaultFrom : $this->defaultTo;

Link to comment
  • 1 month later...
  • 3 weeks later...
  • 1 month later...

Quite new to Alfred but thought it might be a useful hint anyway... apologies if it is beneath the 'level'....

 

I just created a short TextExpander snippet to speed up the process...

 

Having set currencies to From USD to GBP

 

I have a snippet that is just $£ that expands to Currency - I then just type the amount... I think it makes an already useful workflow even easier.

 

 

Link to comment
  • 4 weeks later...
  • 5 months later...

Nice one. What’s missing is an optional preference to round the output value to 2 decimal places if the input value is NOT EQUAL to 1.

 

Explanation:

  • If one enters no input value or 1, it means the user is interested in the exchange rate in full detail. Example: EUR 1 = USD 1.3533.
  • If however the input value is an "actual" cost/price, so the input DOES NOT EQUAL 1(.00), it is clear that this input is an "actual" conversion of that price/cost. Example: EUR 0.23 or EUR 154.89 as input value looks like an actual price.
  • An alternative (better ???) method to decide when to round to 2 decimal digits and when not to round, might be the size of the output (!) number itself (= number of digits in front of the comma/period). Example: When the input value of a large scale mass-produced item is lets say EUR 4.53, the third decimal place of the resulting USD value (so those 0.x Cents) might be important, thus the full number should be copied to the clipboard. If the output result however is USD 183.48(7) the out result should be rounded to 2 decimals -> 183.49 should be displayed and copied to the clipboard.
Link to comment
  • 4 weeks later...
  • 9 months later...
  • 2 months later...
  • 9 months later...

Hi

 

Thank you so much for this great workflow, really helpful. Is there any easy way to change from where the information is collected? So instead of google finance, to use another service? In some countries (eg. China) google is unavailable, and when not connected to a VPN the workflow doesn't work.

Link to comment
  • 2 months later...
  • 1 year later...
  • 1 month later...
  • 6 months later...

This workflow ceased working some weeks ago. It appears to be abandoned.

 

It generates a query error. There is a way to fix it.

 

View the workflow in Finder.
Edit the file:  `/libs/e4QuerySend.php`

Change line 56. It is currently:
 

$response = $this->app->sendHTTPRequest('http://www.google.com/finance/converter?'.http_build_query(array(

Change it to:

$response = $this->app->sendHTTPRequest('https://finance.google.com/finance/converter?'.http_build_query(array(


You can view the required changes here, https://github.com/bigluck/alfred2-currencyconverter/pull/22/files - courtesy of Enochenti.

 

It will now work as before.

Link to comment
  • 1 month later...

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