Giter VIP home page Giter VIP logo

alfred-calculate-anything's Introduction

Calculate Anything

Calculate Anything is a workflow for Alfred 5, that uses natural language and is able to calculate multiple things like currency, cryptocurrency, time, vat, px, em, rem, percentage, and more.

Why

There are several conversion workflows out there but I wanted a workflow that worked naturally. For example, you can open Alfred, type 100 + 9 and get a result. No need for keywords or hotkeys -- it just works. With Calculate Anything you can do the same, simply type 100 + 16%, 100 euros to usd, 100km in cm or 100 years to hours and many more.

Features

  • Natural language - type 100 euros to dollars, 100 euros in usd, 100€ to $, 100eur usd, 100 euros a dolares -- it does not matter, the same result will be displayed
  • Multiple languages - the workflow has support for natural language in English, Spanish and Swedish
  • Currency - Up to 168 currencies
  • Cryptocurrency - Support for 5,000 cryptocurrencies
  • Units - 100 kilometers to meters or 100 km to m or simply 100km m
  • Data Storage - 100 gigabytes in megabytes, 2 gb to mb, 400MiB to kib, 2tb gb etc.
  • Percentages - 100 + 16%, 100 - 16%, 40 as a % of 50, 20 is what % of 50 etc.
  • px,em,rem,pt - 12px or 12px to em or 12px pt
  • Time - time +15 years, time now plus 6 hours or convert a timestamp
  • VAT - value added tax calculations, we all need this
  • Translations You can create your own translations to display results in your language
  • Keywords Extend the natural language support so you can type 100 dolares a pesos and see the result of 100usd to mxn

Installation

Install from the workflow gallery if dependencies are not automatically installed by Alfred you can install them directly from Alfred https://www.alfredapp.com/help/kb/dependencies/ or manually install PHP with brew brew install php.

Configuration

The workflow can be configured using the new workflow configuration panel included in ALfred 5.

Currency

You can use natural language or a few characters -- that's all! For example:

- 100 us dollars in mexican pesos
- 100 canadian dollars in argentinian peso
- 100 euros to dollars
- 100 euros in dollars
- 100 euros as dollars
- 100 euros a dolares (you can also write it in your own language)
- 100 usd to mxn
- 100 usd mxn
- 100usd yen
- 100€ to $
- 100 ¥ in- 100¥ €
- 100eur (if no target the currency will be converted to the base currencies that you configured)

You can set a base currencies so if you type for example 120 euros it will be automatically converted to the currencies that you configured.

All these examples just work. You can add spaces between the value and the currency or not.

Currency Modifiers

When a result is displayed you can use action modifiers to copy the value in different formats:

  • Return Press Return to copy the value with format, for example 2,376.54
  • Command + Return Press Command + Return to copy the value without formatting, for example 2376.54
  • Option + Return Press Option + Return to copy the value of a single unit, for example 23.76

Currency API Key

You need to get a free API key from https://fixer.io -- it takes less than a minute! You can configure the API key in the new workflow configuration window.

Currency Symbols

You can use currency symbols in your query. For example 100¥ to € will be converted from 100 Japanese yen to the equivalent in Euros. Here is a list of available symbols:

Please note: This list only shows symbols that can be used instead of the currency code, the workflow supports up to 168 currency codes.

Symbol Currency Value
EUR. Euro.
¥ JPY. Japanese yen.
$ USD. United States dollar.
R$ BRL. Brazilian real
лв BGN Bulgarian lev
KHR Cambodian riel
CNY Renminbi
CNY Renminbi
CRC Costa Rican colon
CUP Cuban peso
CZK Czech koruna
kr DKK Danish krone
RD$ DOP Dominican peso
£ GBP Pound sterling
¢ GHS Ghanaian cedi
Q GTQ Guatemalan quetzal
L HNL Honduran lempira
Ft HUF Hungarian forint
INR Indian rupee
Rp IDR Indonesian rupiah
IRR Iranian rial
ILS Israeli new shekel
J$ JMD Jamaican dollar
KRW South Korean won
ден MKD Macedonian denar
RM MYR Malaysian ringgit
MT MZN Mozambican metical
ƒ ANG Netherlands Antillean guilder
C$ NIO Nicaraguan córdoba
NGN Nigerian naira
B/. PAB Panamanian balboa
Gs PYG Paraguayan guaraní
S/. PEN Peruvian Sol
TRY Turkish Lira
TT$ TTD Trinidad and Tobago dollar
TT$ TTD Trinidad and Tobago dollar
UAH Ukrainian hryvnia

Cryptocurrency

Calculate Anything can convert between 5,000 cryptocurrencies and you can define your own. Again, you can use natural language or simply pass the currency symbol.

- 2 bitcoins to dollars
- 0.1 bitcoin in dollars
- 5 bitcoins in ethereum
- 1 ethereum to ¥
- 10 ethereum in mxn
- 1eth btc
- 1btc (if no target currency is provided, the configured base currency will be used)

Cryptocurrency Modifiers

When a result is displayed you can use action modifiers to copy the value in different formats:

  • Return Press Return to copy the value with format, for example 2,376.54
  • Command + Return Press Command + Return to copy the value without formatting, for example 2376.54
  • Option + Return Press Option + Return to copy the value of a single unit, for example 23.76

Cryptocurrency Api Key

You need to get a free API key from https://coinmarketcap.com/api/pricing/. This takes less than a minute.

Units

You can write your query using natural language or just a few characters. Either way works!

- 100 kilometers to meters
- 100 km in meters
- 100 km m
- 100km m

- 100 miles as meters
- 100miles in meters
- 100 miles to m

- 100 ounces to kilograms
- 100oz to kg
- 100oz = kg
- 100oz kg

- 10 years to months
- 10years to seconds
- 10 years hr
- 1 year to sec
- 1hr secods
- 1hr s
- 10 days hr
- 10as a horas (use your own language)

If you don't remember the unit abbreviation, simply type the name of the unit. For example, instead of "oz" you can type "ounce" or "ounces" or even use words in your own language like "onza" or "onzas" in Spanish.

Unit Modifiers

When a result is displayed you can use action modifiers to copy the value in different formats:

  • Return Press Return to copy the value with format, for example 2,376.54
  • Command + Return Press Command + Return to copy the value without formatting, for example 2376.54
  • Option + Return Press Option + Return to copy the value of a single unit, for example 23.76

Here is a list of all available units and their names just to make this README even longer.

Available Length Units

Unit Unit Name
m Meter
km Kilometer
dm Decimeter
cm Centimeter
mm Milimeter
μm Micrometer
nm Nanometer
pm Picometer
in Inch
ft Foot
yd Yard
mi Mile
nmi Nautical Mile
h Hand
ly Lightyear
au Astronomical Unit
pc Parsec

Available Area Units

Unit Unit Name
m2 Square Meter
km2 Square Kilometer
cm2 Square Centimeter
mm2 Square Milimeter
ft2 Square Foot
mi2 Square Mile
ha Hectare

Available Volume Units

Unit Unit Name
l Litre
ml Mililitre
m3 Cubic Meter
kl kilolitre
hl hectolitre
qt Quart
pt Pint (US Pint)
ukpt Pint (UK Pint)
gal Gallon (US Gallon)
ukgal Gallon (UK Gallon)
floz Fluid ounce

Available Weight Units

Unit Unit Name
kg Kilogram
gl Gram
mg Miligram
N Newton
st Stone
lb Pound
oz Ounce
t Metric Tonne
ukt UK Long Ton
ust US Short Ton

Available Speed Units

Unit Unit Name
mps Meters Per Second
kph Kilometers Per Hour
mph Miles Per Hour
fps Feet Per Second

Available Rotation Units

Unit Unit Name
deg Degrees
rad Radian

Available Temperature Units

Unit Unit Name
k Kelvin
c Centigrade
f Fahrenheit

Available Pressure Units

Unit Unit Name
pa Pascal
kpa Kilopascal
mpa Megapascal
bar Bar
mbar Milibar
psi Pound-force Per Square Inch

Available Time Units

Unit Unit Name
s Second
year Year
month Month
week Week
day Day
hr Hour
min Minute
ms Milisecond
μs Microsecond
ns Nanosecond

Available Energy/Power Units

Unit Unit Name
j Joule
kj Kilojoule
mj Megajoule
cal Calorie
Nm Newton Meter
ftlb Foot Pound
whr Watt Hour
kwhr Kilowatt Hour
mwhr Megawatt Hour
mev Mega Electron Volt

Data Storage

You can write your query using natural language or just a few characters. Either way works!

- 100 gigabytes in megabytes
- 100 gigas in megas
- 100 Mebibytes in Kibibytes
- 100 gb to mb
- 100gb to kb
- 100gb mb
- 400MiB in kib
- 2tb gb
- 1b kb

Please note, this workflow follows the IEC Standard (International Electrotechnical Commission) as it had been adopted by the IEEE, EU, and NIST. That means that if you type 1MB in KB you will get 1000 KB but if you type 1MiB in KiB you will get 1024 KB, you can read more about it here Multiple-byte_units

Do you prefer 1 MB = 1024 KB? No problem, you can configure it using the Configure Workflow window.

Data Storage Modifiers

When a result is displayed you can use action modifiers to copy the value in different formats:

  • Return Press Return to copy the value with format, for example 2,376.54
  • Command + Return Press Command + Return to copy the value without formatting, for example 2376.54

Data Storage Available Units

Unit Unit Name
B Byte
kB Kilobyte
MB Megabyte
GB Gigabyte
TB Terabyte
PB Petabyte
EB Exabyte
ZB Zettabyte
YB Yottabyte
bit bit
KiB Kibibyte
MiB Mebibyte
GiB Gibibyte
TiB Tebibyte
PiB Pebibyte
EiB Exbibyte
ZiB Zebibyte
YiB Yobibyte

Percentages

You can easily calculate percentages. For example:

- 40 as a % of 50  // 40 is 80% of 50
- 20 is what % of 50 // 20 is 40% of 50
- 15% of 50 = 7.50  // 7.5 equals to 15% of 50
- 120 + 30% = 156  // 120 plus the 30% of 120
- 120 plus 30% = 156  // 120 plus the 30% of 120
- 120 - 30% = 84  // 120 minus the 30% of 120
- 120 minus 30% = 84  // 120 minus the 30% of 120
- 30 % 40 = 75%  // 30 is 75% of 40

Translations and natural language can also be used
- 120 más 30% = 156
- 120 menos 10% = 108
- 40 como % de 50 = // 40 es 80% de 50

PX, EM, REM, PT

Open Alfred, type 12px and you'll see the value converted to em, rem and pt. It's that simple. Check the examples below.

- 12px
- 12px to em
- 2 rem
- 2rem
- 2rem to pt

# use a custom px base or configure it in the workflow
- 12px in em base 17px

Time

Given its less frequently used, time conversions require the use of the keyword time.

# converts the timestamp to a regular date
- time 1577836800

# gives you the time from now plus 15 days
- time +15 days
- time now plus 3 days

# gives you the time from now plus 3 working days
- time today + 3 workdays
- time now + 3 workdays
- time + 3 workdays

# number of days until specified date
- time days until 31 december

# the start date of current year
- time start of year

# the start date of specified year
- time start of 2021

# the end date of current year
- time end of year

# the end date of specified year
- time end of 2021

# it also works in your language
- time inicio de 2020
- time fin de 2020
- time dias hasta 31 diciembre

# get information about date
- time 31 December, 2021 18:00:00
- time 31/12/2021 18:00:00
- time 12/31/2021 18:00:00

# calculate the difference between two dates
- time 25 December, 2021 - 31 December, 2021
- time 31-11-2019 - 21-11-2019
- time 11/31/2019 - 11/21/2019

Time Options

The following options are available. Simply launch Alfred, type ca and select any of the options below. View the configuration section for more info.

  • Set base timezone Base time zone used to calculate dates in your time zone, search and select your zone from the list and press Return to save it.
  • Add date format Configure a new date format so the date is displayed the way you want, for example j F, Y, g:i:s a (more information about available values for date)

VAT (Value Added Tax)

With this you can calculate the VAT for a given amount. Like time, VAT is also triggered with a keyword. By default, the keyword is "vat" but you can change the keyword in the workflow.

Given the following query

vat of 400 (with a 16% VAT configured, a percentage you can configure)

Calculate Anything will provide the following conversions:

  • VAT of 400 = 64 (the VAT amount)
  • 400 plus VAT = 464 (the Amount plus VAT)
  • 400 minus VAT = 344.82 (the Amount minus VAT, useful if you have a final amount and want to know the VAT applied)

Languages

This is a list of available languages:

Language Code
English en_EN
Spanish es_ES
Swedish sv_SE

To create your own translation, just follow these steps:

  1. Copy and paste /lang/en_EN.php and /lang/en_EN-keys.php into the same folder
  2. Change the name of the pasted files to your country lang code, for example ru_RU.php and ru_RU-keys.php
  3. Open and translate ru_RU.php
  4. Open and modify ru_RU-keys.php. Read more about this file in the section Keywords.
  5. Share it with the world -- and me! (I welcome pull requests or links to services like pastebin.com)

Keywords

Keywords are words that can be used when writing a query in natural language. For example, by default, the keyword "ounces" will be converted to "oz", "kilometers" will be converted to "km" and "dollars" will be converted to "USD". Keywords allow the user to type in a more natural way and in their own language.

'units' => [
    'hours' => 'hr',
    'hour' => 'hr',
    'kilometers' => 'km',
    'ounces' => 'oz',
    'ounce' => 'oz',
    'hakunamatata' => 'year',  // try adding this
    ...
],

If the user the types:
1 hakunamatata to months, the result will be 12

There is no limit to the keywords that you can add.

Stop Words

Stop words are words that can be used in the query when using natural language, for example 100km to cm. Here the stop word is "to".

Stop words are useful for two things:

  1. Allow the user to write more naturally and in their own language (e.g 100 dolares a mxn) "a" is the stop word
  2. Check if the query has to be processed

For example:

100km equals meters

If the word "equals" is not registered in the stop_words array then it won't be processed. After processing, stop words are removed so 100km to cm is understood as 100km cm.

You can modify stop words in the same keys file, for example /lang/en_EN-keys.php.

'units' => [
    'hours' => 'hr',
    'hour' => 'hr',

    'stop_words' => ['to', '=']
    ...
],

Performance

For currency, percentage and unit conversions, Calculate Anything will only process the query if it begins with a digit and has at least 3 characters. Time and VAT conversions need a keyword because they are not often used.

Deleting cache

The workflow stores information about currency and cryptocurrency rates, to clear the cache open alfred and type _caclear

Changelog

The Changelog is available here.

alfred-calculate-anything's People

Contributors

augusl avatar biati-digital avatar chrismessina avatar emresaracoglu avatar flightmansam avatar jun6lee avatar matthewmcvickar avatar pyrmont avatar twang817 avatar wwkeyboard avatar yock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

alfred-calculate-anything's Issues

Time Function not working

Are you using the latest version of the workflow?
Yes. On MacOS Monterey. M1 MacBook.

Describe the bug
Typing any query like "time start of 2021" returns no results.

To Reproduce
Screenshot 2021-11-28 at 8 56 31 AM

Expected behavior

Debug Output
Screenshot 2021-11-28 at 8 57 46 AM Redacted

System information:

  • OS: Mac OS 12.0.1
  • Alfred Version: 4.6.1
  • PHP Version - 8.0.13

Fixer API Key breaking currency conversion

If you have a problem with the workflow please answer the following questions.

Are you using the latest version of the workflow?
Yes. Current version installed is 3.1.1 (lasted updated Nov 1)

Describe the bug
There seems to be an issue converting currency after I entered the Fixer.io API Key. The conversion seemed fine without it.

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred
  2. Type 'ca set' and select ["Set Fixer API"]
  3. Enter my Free Fixer API, and press enter to save
  4. Type '100 usd'
  5. See error

Expected behavior
I expected the currency conversion / calculation to occur.

Working with default setup:

image

Note: This is not an issue for default conversion mechanism.

*****This only occurs when I enter have a Fixer API Key.

Debug Output

Not working with API Key entered (with any currency)

image

image

Please enable debug (see image) open Alfred and type the conversion that it's not working, you will see that the debug window is populated with a lot of text, please paste that text in here.

System information:

  • OS: [Mac OS 12.1]
  • Alfred Version [Alfred 4.6.1]
  • PHP Version: PHP 8.1.1 (cli) (built: Dec 17 2021 22:21:23) (NTS)

Additional context
You've created quite an amazing work flow / app, so I felt compelled to let you know a bug when I see one.
It currently works for me with the default currencies. Congratulations and thank you!

Support specifying location / TZ in time

This is a cool workflow; supersedes couple of workflows I use.

Could time also support showing time for a different location (city maybe) or Timezone (PST)? Support for natural language would be a plus, i.e time in Chicago after 1 hour

Feature Request: Support for more cryptocurrencies

Please could we get support for more cryptocurrencies than the 100 hardcoded?

The API appears to allow up to 5000 to be requested in one request. Could it be set to dynamically support the top 1000 say? Or does Alfred require a hardcoded list to know to call this workflow?

If so, is it possible to maybe cache the top 1k daily for example and reference that list?

I'd be happy to sacrifice some ease of use and type something else to tell it I want to look for a non-hardcoded currency, if that would make it possible.

Calculate configure function - pressing enter

If you have a problem with the workflow please answer the following questions.

Describe the bug
A clear and concise description of what the bug is.
I was trying to change the date format etc. and used the "calculate configure" function to do this. When the options come up and I want to configure something, I press enter and the search box dissapears - I'm unable to change it.

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred 'command + spacebar'
  2. Type 'calculate configure'
  3. See options for what options to configure (e.g. "set base language")
  4. Press enter or "cmd + 1" (for set base language)
  5. Search box dissapears - unable to change "set language" or any other option

Expected behavior
After pressing "ENTER" it should give you the option to configure whatever you've chosen...

Debug Output
[11:50:59.494] Logging Started...
[11:51:01.319] Calculate Anything[Script Filter] Queuing argument ''
[11:51:01.321] Calculate Anything[Script Filter] Queuing argument '(null)'
[11:51:01.390] Calculate Anything[Script Filter] Script with argv '(null)' finished
[11:51:01.391] Calculate Anything[Script Filter] {"items": [{"title":"Set base language","subtitle":"Configure the base language: en_EN","valid":true,"arg":"language","match":"Set base language","autocomplete":null},{"title":"Add base currency","subtitle":"Set a base currency: GBP","match":"Add base currency","autocomplete":"Add base currency","valid":true,"arg":"add_base_currency"},{"title":"Delete base currency","subtitle":"Delete configured base currency","match":"Delete base currency","autocomplete":"Delete base currency","valid":true,"arg":"delete_base_currency"},{"title":"Set currency locale","subtitle":"Used to give format to the value using your country format: en_US","match":"Set currency locale","autocomplete":"Set currency locale","valid":true,"arg":"locale_currency"},{"title":"Set Coinmarketcap API","subtitle":"Configure your coinmarketcap API Key: ","match":"Set Coinmarketcap API","autocomplete":"Set Coinmarketcap API","valid":true,"arg":"coinmarket_apikey"},{"title":"Set Fixer API","subtitle":"Configure your fixer API Key: ","match":"Set Fixer API","autocomplete":"Set Fixer API","valid":true,"arg":"fixer_apikey"},{"title":"Set System of Measurement","subtitle":"Define your system of measurement default to metric system: metric","match":"Set System of Measurement","autocomplete":"Set System of Measurement","valid":true,"arg":"measurement_system"},{"title":"Set VAT percentage","subtitle":"Configure your default VAT percentage: 16%","match":"Set VAT percentage","autocomplete":"Set VAT percentage","valid":true,"arg":"vat_percentage"},{"title":"Set base timezone","subtitle":"Base time zone to calculate dates in your time: London","match":"Set base timezone","autocomplete":"Set base timezone","valid":true,"arg":"time_zone"},{"title":"Add date format","subtitle":"Add date format","match":"Add date format","autocomplete":"Add date format","valid":true,"arg":"add_time_zone"},{"title":"Delete date format","subtitle":"Delete configured date format","match":"Delete date format","autocomplete":"Delete date format","valid":true,"arg":"delete_time_zone"},{"title":"Set base pixels","subtitle":"Configure the base pixels for font calculations: 16px","match":"Set base pixels","autocomplete":"Set base pixels","valid":true,"arg":"base_pixels"}] }
[11:51:01.393] Calculate Anything[Script Filter] Script with argv '(null)' finished
[11:51:01.393] Calculate Anything[Script Filter] {"items": [{"title":"Set base language","subtitle":"Configure the base language: en_EN","valid":true,"arg":"language","match":"Set base language","autocomplete":null},{"title":"Add base currency","subtitle":"Set a base currency: GBP","match":"Add base currency","autocomplete":"Add base currency","valid":true,"arg":"add_base_currency"},{"title":"Delete base currency","subtitle":"Delete configured base currency","match":"Delete base currency","autocomplete":"Delete base currency","valid":true,"arg":"delete_base_currency"},{"title":"Set currency locale","subtitle":"Used to give format to the value using your country format: en_US","match":"Set currency locale","autocomplete":"Set currency locale","valid":true,"arg":"locale_currency"},{"title":"Set Coinmarketcap API","subtitle":"Configure your coinmarketcap API Key: ","match":"Set Coinmarketcap API","autocomplete":"Set Coinmarketcap API","valid":true,"arg":"coinmarket_apikey"},{"title":"Set Fixer API","subtitle":"Configure your fixer API Key: ","match":"Set Fixer API","autocomplete":"Set Fixer API","valid":true,"arg":"fixer_apikey"},{"title":"Set System of Measurement","subtitle":"Define your system of measurement default to metric system: metric","match":"Set System of Measurement","autocomplete":"Set System of Measurement","valid":true,"arg":"measurement_system"},{"title":"Set VAT percentage","subtitle":"Configure your default VAT percentage: 16%","match":"Set VAT percentage","autocomplete":"Set VAT percentage","valid":true,"arg":"vat_percentage"},{"title":"Set base timezone","subtitle":"Base time zone to calculate dates in your time: London","match":"Set base timezone","autocomplete":"Set base timezone","valid":true,"arg":"time_zone"},{"title":"Add date format","subtitle":"Add date format","match":"Add date format","autocomplete":"Add date format","valid":true,"arg":"add_time_zone"},{"title":"Delete date format","subtitle":"Delete configured date format","match":"Delete date format","autocomplete":"Delete date format","valid":true,"arg":"delete_time_zone"},{"title":"Set base pixels","subtitle":"Configure the base pixels for font calculations: 16px","match":"Set base pixels","autocomplete":"Set base pixels","valid":true,"arg":"base_pixels"}] }
[11:51:12.954] Calculate Anything[Script Filter] Processing complete
[11:51:12.958] Calculate Anything[Script Filter] Passing output 'delete_time_zone' to Run Script
[11:51:13.018] Calculate Anything[Run Script] Processing complete
[11:51:13.019] Calculate Anything[Run Script] Passing output '' to Post Notification

System information:

  • OS: Mac OS 11.2 (Big Sur)
  • Alfred Version 4
  • PHP Version - Terminal gives this message after typing "php -v": PHP is included in macOS for compatibility with legacy software.
    Future versions of macOS will not include PHP.
    PHP 7.3.24-(to be removed in future macOS) (cli) (built: Dec 21 2020 21:33:25) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.3.24, Copyright (c) 1998-2018 Zend Technologies

Additional context
Add any other context about the problem here.

Incorrect base value for several Volume Units

Describe the bug
Incorrect volume conversions. (I did not check all, just few I was interested in)

Current base values:
"pt" => array("base" => "l", "conversion" => 0.56826125), //pint
"gal" => array("base" => "l", "conversion" => 4.405), //gallon
"qt" => array("base" => "l", "conversion" => 1.1365225), //quart

I believe those should be used:
"pt" => array("base" => "l", "conversion" => 0.473176473), //pint
"gal" => array("base" => "l", "conversion" => 3.78541178), //gallon
"qt" => array("base" => "l", "conversion" => 0.946352946), //quart

Automatically show base currency results after number without typing the currency symbol

For the people who use more than one base currency, it's frequent for us to convert among them.

For instance, I personally use CNY and USD as my two base currencies. More than 99%, I convert from CNY to USD, or vice versa.

It's helpful if it can automatically show several base-to-base currency conversion results once I type in the number without declaring the currency symbol (or else leave this as an option for convenience).

An example from another currency workflow showed as below:

image

While in this workflow, it's not that smart:

image

image

Converting currencies does not work

Are you using the latest version of the workflow?
Yes

Describe the bug
When trying to convert currencies calculate anything does not work, all I am getting are default searches.

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred '...'
  2. Type '600 usd to eur'
  3. See only the searches options

Expected behavior
Converted value is displayed

Debug Output
image

ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0. in JSON:
Deprecated: Function money_format() is deprecated in /Users/janko/Documents/Alfred/Alfred.alfredpreferences/workflows/user.workflow.D46C1DFA-AA24-4138-8DCA-E37022618D37/workflow/tools/currency.php on line 266

Deprecated: Function money_format() is deprecated in /Users/janko/Documents/Alfred/Alfred.alfredpreferences/workflows/user.workflow.D46C1DFA-AA24-4138-8DCA-E37022618D37/workflow/tools/currency.php on line 269
{"items":[{"title":"105,53 EUR","subtitle":"1 USD = 0,88 EUR","arg":"105,53","icon":{"path":"assets/flags/EUR.png"},"mods":{"cmd":{"valid":true,"arg":10553,"subtitle":"Action this item to copy the amount with no format"},"alt":{"valid":true,"arg":88,"subtitle":"Action this item to copy the value of 1 to the clipboard"}}}]}

System information:

  • OS: Mac OS 12.0.1
  • Alfred Version 4.6
  • PHP Version - 7.4.25

Additional context

Feature Request: Modulo operation

% currently only calculates the percentage, but in programming it's common to use it to calculate the remainder of a division, for example 5 % 2 = 1.

I would like to see the workflow return both.

Cryptocurrency Support

Great workflow, one of the best I've seen so far - good job!

Was just wondering if there's a chance you could add support for cryptocurrencies too? Looks like Fixer.io only supports Bitcoin.

CoinMarketCap seems to have a free API where we could grab our own keys:
https://coinmarketcap.com/api/

Unable to run task

Hi,

since I upgraded to macOS Monterey I can not run your workflow anymore.

Are you using the latest version of the workflow?
Currently, I am using v.3.0.2

Describe the bug
When I type "ca" I got the following error message "Unable to run task". (Screenshot attached)

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred '...'
  2. Type 'ca'
  3. See error

Debug Output
See attachment
Screen Shot 2021-11-01 at 11 40 41
Screen Shot 2021-11-01 at 11 56 09

System information:

  • OS: macOS Monterey 12.0.1
  • Alfred Version 4.6

Vat not accurate

If you have a problem with the workflow please answer the following questions.

Describe the bug
A clear and concise description of what the bug is.
Vat is not accurate

To Reproduce
Steps to reproduce the behavior:
ca Set Vat was set to 7.75
Vat 100 produce
VAT of 100 = 7 should be 7.75
100 plus VAT = 107, should be 107.75
100 minus VAT = 58.82 This doesn't make sense

Expected behavior
A clear and concise description of what you expected to happen.

Debug Output
Debug

Please enable debug (see image) open Alfred and type the conversion that it's not working, you will see that the debug window is populated with a lot of text, please paste that text in here.

System information:

  • OS: 10.15.7
  • Alfred Version 4.3.4
  • PHP Version 8.0.6

Additional context
Add any other context about the problem here.
image

image

Time function is broken

Hi,

I'm not able to use "time" function. It does show up when I write "time" but quickly goes away when I add something else.

I have no other function linked to "time" keyword.

image

My Config if can help is Mac M1.

[Bug] Any temperature conversion results in "Cannot convert between units of different types"

Describe the bug
Alfred fails any and all temperature conversion with CalcAnything version 3.0.0

To Reproduce

Steps to reproduce the behavior:

  1. Open Alfred '...'
  2. Type '100c f'
  3. See error 'Cannot convert between units of different types'

Expected behavior
Successful temperature conversion.

Debug Output
Debug
[17:19:13.131] Calculate Anything[Script Filter] Queuing argument ''
[17:19:13.378] Calculate Anything[Script Filter] Script with argv '(null)' finished
[17:19:13.383] Calculate Anything[Script Filter] {"items":[]}
[17:19:13.946] Calculate Anything[Script Filter] Queuing argument '0'
[17:19:14.138] Calculate Anything[Script Filter] Script with argv '(null)' finished
[17:19:14.142] Calculate Anything[Script Filter] {"items":[]}
[17:19:14.527] Calculate Anything[Script Filter] Queuing argument '00'
[17:19:14.741] Calculate Anything[Script Filter] Script with argv '(null)' finished
[17:19:14.745] Calculate Anything[Script Filter] {"items":[]}
[17:19:15.425] Calculate Anything[Script Filter] Queuing argument '00c'
[17:19:15.618] Calculate Anything[Script Filter] Script with argv '(null)' finished
[17:19:15.625] Calculate Anything[Script Filter] {"items":[]}
[17:19:16.226] Calculate Anything[Script Filter] Queuing argument '00c '
[17:19:16.357] Calculate Anything[Script Filter] Script with argv '(null)' finished
[17:19:16.363] Calculate Anything[Script Filter] {"items":[]}
[17:19:17.247] Calculate Anything[Script Filter] Queuing argument '00c f'
[17:19:17.441] Calculate Anything[Script Filter] Script with argv '(null)' finished
[17:19:17.450] Calculate Anything[Script Filter] {"items":[{"title":"Cannot Convert Between Units of Different Types","arg":false,"subtitle":"Action this item to copy this number to the clipboard","valid":false}]}

System information:

  • OS: [ Mac OS 11.3]
  • Alfred Version [4.3.4]
  • PHP Version - PHP 7.3.24

Additional context
Add any other context about the problem here.

Support basic scientific computation

Do something like sin, cos, tan, log, log2, In, exp, abs, sqrt, asin, acos, atan, sinh, cosh, tanh, asinh, acosh, atanh, ceil, floor, round, trunc, rint, near, dtor, rtod. etc.

image

It should not be that hard because there're lots of scientific computation workflows on Github for reference.

But it depends on your time since we already have an advanced calculator trigger by "=" as a built-in function :)

Time not converting

If you have a problem with the workflow please answer the following questions.

Are you using the latest version?
Yes (in the recording the version is 4.3.4 but I've also tried with 4.5.

Describe the bug
I'm using the time format: j F Y g:i a and the timezone: Bucharest (3 hours difference from UTC).
"time 3pm" shows the date + "3:00 pm" ; under it there's another format showing that it's in 3 hours.
"time 3pm utc" shows the same date ("3:00 pm") yet under it it shows 6 hours.
"time utc" wrongly displays my current timezone's time (not the UTC time).

To Reproduce

  1. Set your computer timezone to GMT+3
  2. Open Alfred
  3. Type 'time 3pm'
  4. It shows '7 August 2021 3:00 pm', under it shows '7 hours, 36 seconds' (if it's 8 am)
  5. Type 'time 3pm utc'
  6. It shows '7 August 2021 3:00 pm' (instead of '7 August 2021 6:00 pm'), under it shows '10 hours'

Here is a video of this happening: https://www.screencast.com/t/3H9M5xSPXEO4

Expected behavior
At 6. it should show '7 August 2021 6:00 pm'

Debug Output
Debug

Please enable debug (see image) open Alfred and type the conversion that it's not working, you will see that the debug window is populated with a lot of text, please paste that text in here.

System information:

  • OS: Mac OS 11.5
  • Alfred Version 4.5
  • PHP Version - To find out the version open the Terminal.app and type: php -v 7.3

Additional context
Add any other context about the problem here.
I was told here to submit using template.

Screenshot 2021-08-07 at 08 03 36

Screenshot 2021-08-07 at 08 04 00

Currency is not working

Currency is not working

[22:19:48.560] Calculate Anything[Script Filter] Queuing argument ''
[22:19:48.834] Calculate Anything[Script Filter] Script with argv '(null)' finished
[22:19:48.851] Calculate Anything[Script Filter] {"items":[]}
[22:19:48.875] Calculate Anything[Script Filter] Queuing argument ' '
[22:19:49.043] Calculate Anything[Script Filter] Queuing argument ' e'
[22:19:49.093] Calculate Anything[Script Filter] Script with argv '(null)' finished
[22:19:49.106] Calculate Anything[Script Filter] {"items":[]}
[22:19:49.192] Calculate Anything[Script Filter] Queuing argument ' eu'
[22:19:49.295] Calculate Anything[Script Filter] Queuing argument ' eur'
[22:19:49.372] Calculate Anything[Script Filter] Queuing argument ' eur '
[22:19:49.583] Calculate Anything[Script Filter] Queuing argument ' eur t'
[22:19:49.731] Calculate Anything[Script Filter] Queuing argument ' eur to'
[22:19:49.841] Calculate Anything[Script Filter] Queuing argument ' eur to '
[22:19:49.958] Calculate Anything[Script Filter] Queuing argument ' eur to d'
[22:19:50.063] Calculate Anything[Script Filter] Queuing argument ' eur to do'
[22:19:50.212] Calculate Anything[Script Filter] Queuing argument ' eur to dol'
[22:19:50.349] Calculate Anything[Script Filter] Queuing argument ' eur to doll'
[22:19:50.405] Calculate Anything[Script Filter] Queuing argument ' eur to dolla'
[22:19:50.499] Calculate Anything[Script Filter] Queuing argument ' eur to dollar'
[22:19:50.572] Calculate Anything[Script Filter] Queuing argument ' eur to dollars'
[22:19:51.063] Calculate Anything[Script Filter] Script with argv '(null)' finished
[22:19:51.088] Calculate Anything[Script Filter] Warning: mkdir(): No such file or directory in /Users/Hidden/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DF56BC08-4B98-4B34-854A-402F8AAB4333/alfred/Alfred.php on line 358

Warning: file_put_contents(/Users/Hidden/Library/Application Support/Alfred/Workflow Data/com.alfred.calculateanything/cache/fixer/rates.json): failed to open stream: No such file or directory in /Users/Hidden/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DF56BC08-4B98-4B34-854A-402F8AAB4333/workflow/tools/currency.php on line 606
{"items":[{"title":{"code":101,"type":"invalid_access_key","info":"You have not supplied a valid API Access Key. [Technical Support: [email protected]]"},"valid":false,"arg":""}]}
[22:19:51.090] ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Warning: mkdir(): No such file or directory in /Users/Hidden/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DF56BC08-4B98-4B34-854A-402F8AAB4333/alfred/Alfred.php on line 358

Warning: file_put_contents(/Users/Hidden/Library/Application Support/Alfred/Workflow Data/com.alfred.calculateanything/cache/fixer/rates.json): failed to open stream: No such file or directory in /Users/Hidden/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.DF56BC08-4B98-4B34-854A-402F8AAB4333/workflow/tools/currency.php on line 606
{"items":[{"title":{"code":101,"type":"invalid_access_key","info":"You have not supplied a valid API Access Key. [Technical Support: [email protected]]"},"valid":false,"arg":""}]}

Expected behavior
Convert currency

System information:

  • OS: 10.14.6
  • Alfred Version 4.3.4 [1228]
  • PHP Version PHP 7.1.33

Additional context
Add any other context about the problem here.

Base currency not converting cryptocurrencies properly

If you have a problem with the workflow please answer the following questions.

Are you using the latest version of the workflow?
Yes. Current version installed is 3.1.1 (lasted updated Nov 1)

Describe the bug
When querying cryptocurrency, the conversion only occurs for USD. Other base currencies, in my case, all 1 BTC calculates to 0.00 in CNY, EUR, TWD.

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred
  2. Type 'ca add' and select ["Add base currency"]
  3. Add any countries/currencies as desired, and press enter to save
  4. Type '1btc'
  5. See error

Expected behavior
I expected the currency conversion / calculation to occur and show corresponding to the cryptocurrency entered (BTC, ETH, etc).

Debug Output
image

Please enable debug (see image) open Alfred and type the conversion that it's not working, you will see that the debug window is populated with a lot of text, please paste that text in here.

System information:

  • OS: [Mac OS 12.1]
  • Alfred Version [Alfred 4.6.1]
  • PHP Version: PHP 8.1.1 (cli) (built: Dec 17 2021 22:21:23) (NTS)

Additional context
A small oversight, but still a bug. However, you've created quite an amazing work flow / app! Congratulations and thank you!

I can't make some units work

I'm not sure if this is user error; at the very least is a confusing workflow. Since I'm usually having trouble with pounds, I added this to my en_EN-keys.php

'pound' => 'lb',
'pounds' => 'lb',

So, here are some inconsistencies IMO:

This works
image

But this doesn't
image

But it works this way after adding it to en_EN-keys.php
image

This one is about precision that anything else, but still.
image

Thanks for the effort

Nothing works

Describe the bug
Conversion is simply not working. Try to type 100$ or 1 hour to seconds and it only shows Search Google for...

To Reproduce
Steps to reproduce the behaviour:

  1. Trigger Alfred
  2. Type 100$
  3. See errors

Expected behaviour
It should convert 100$ to my base currency in the line below.

Debug Output
Debug

System information:

  • OS: macOS 11.2.1
  • Alfred Version: 4.3.4 [1229]
  • PHP Version - 7.3.24 Screen Shot 2021-05-30 at 23 23 12

Additional context
About 10 days ago when I installed this workflow, it worked well. Today I try to use it but it turns out to be broken somehow.
I already reinstalled this workflow by downloading the latest version from Release page but it didn't fix the issue.

Subtitle not formatted according the currency locale in crypto conversions (title is good)

Describe the bug
Subtitle not formatted according the currency locale in crypto conversions (title is good).

To Reproduce
Screen Shot 2021-04-13 at 02 36 55

Expected behavior
Subtitle formatted according the currency locale.

Debug Output

[02:41:31.759] Calculate Anything[Script Filter] Queuing argument ' btc in ars'
[02:41:31.964] Calculate Anything[Script Filter] Script with argv '(null)' finished
[02:41:31.967] Calculate Anything[Script Filter] {"items": [{"title":"5.620.679,81ARS","subtitle":"1BTC = 5,620,679.80ARS","arg":"5.620.679,81","icon":{"path":"flags\/ARS.png"},"mods":{"cmd":{"valid":true,"arg":5.62,"subtitle":"Action this item to copy the amount with no format"},"alt":{"valid":true,"arg":5620679.8,"subtitle":"Action this item to copy the value of 1 to the clipboard"}}}] }

System information:

  • OS: macOS 11.2.3
  • Alfred Version: 4.3.2
  • PHP Version: 7.3.24

Any queries broken after update to 3.0.1 (from 2.x)

Describe the bug
Any requests to alfred-calculate-anything are broken

To Reproduce

  1. Open Alfred '...'
  2. Type any request (like 100 USD)
  3. See nothing
    image

Expected behavior
Expect working output as with past versions

Debug Output
[15:06:08.026] Calculate Anything[Script Filter] Queuing argument ''
[15:06:08.123] Calculate Anything[Script Filter] Queuing argument '0'
[15:06:08.294] Calculate Anything[Script Filter] Queuing argument '00'
[15:06:09.268] Calculate Anything[Script Filter] Script with argv '(null)' finished
[15:06:09.271] ERROR: Calculate Anything[Script Filter] Code 255: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /Users/aa.golovin/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FB55A8E0-8557-40AA-972D-481DE638ABFA/alfred/Alfred.php on line 136
[15:06:09.272] ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /Users/aa.golovin/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.FB55A8E0-8557-40AA-972D-481DE638ABFA/alfred/Alfred.php on line 136

System information:

  • OS: 10.15.7
  • Alfred Version: 4.3.4
  • PHP Version: 7.3.11 (cli) (built: Jun 5 2020 23:50:40) ( NTS )

Currency Conversion not working

If you have a problem with the workflow please answer the following questions.

Describe the bug
A clear and concise description of what the bug is.
I was getting a lot of errors and I mean a lot, After debugging on my own and comparing with my laptop on which the workflow works perfectly, I noticed that the workflow uses MacOS own PHP which is version 7.3.11 where I have brew PHP installed and currently have 7.4.14, anyway I noticed I had a php.ini file in /etc on my computer and not on my laptop, so I deleted it and it got rid of so many errors, but still currency conversion is throwing an error:

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred '...'
  2. Type '100 euros to dollars'
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.
shows the price in usd

Debug Output
Debug

[15:12:19.834] Logging Stopped.
[15:12:25.919] Logging Started...
[15:12:32.097] Calculate Anything[Script Filter] Queuing argument '00 euros to dollars'
[15:12:32.163] Calculate Anything[Script Filter] Script with argv '(null)' finished
[15:12:32.163] Calculate Anything[Script Filter] Warning: Division by zero in /Users/yamantarakji/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AC90BED8-9A7B-4593-98BB-EE8B929141F6/workflow/tools/currency.php on line 387
{"items": [{"title":".USD","subtitle":"1EUR = 0.00USD","arg":".","icon":{"path":"flags\/USD.png"},"mods":{"cmd":{"valid":true,"arg":0,"subtitle":"Action this item to copy the amount with no format"},"alt":{"valid":true,"arg":0,"subtitle":"Action this item to copy the value of 1 to the clipboard"}}}] }
[15:12:32.164] ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Warning: Division by zero in /Users/yamantarakji/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.AC90BED8-9A7B-4593-98BB-EE8B929141F6/workflow/tools/currency.php on line 387
{"items": [{"title":".USD","subtitle":"1EUR = 0.00USD","arg":".","icon":{"path":"flags\/USD.png"},"mods":{"cmd":{"valid":true,"arg":0,"subtitle":"Action this item to copy the amount with no format"},"alt":{"valid":true,"arg":0,"subtitle":"Action this item to copy the value of 1 to the clipboard"}}}] }

Please enable debug (see image) open Alfred and type the conversion that it's not working, you will see that the debug window is populated with a lot of text, please paste that text in here.

System information:

  • OS: [e.g. Mac OS 10.15.15]
  • Alfred Version [e.g. 4]
  • PHP Version - To find out the version open the Terminal.app and type: php -v

MacOS: 10.15.7
Alfred: 4.3.2
PHP 7.4.14 (brew) and 7.3.11 (macos) (which is what the workflow is using)

Additional context
Add any other context about the problem here.

Not respecting (,) and period (.)

When I enter say 23,51 CHF ist interpretes it as 2351 instead of 23.51. Here in Germany 23,51 CHF = 23.51. Is there any way to fix this?

I've installed the workflow version 2.04.
I've also set it to base language de_DE, still no success.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes)

This is what I get when trying the CA keyword. I can't use another features as well because of the same error.

[11:16:24.431] Calculate Anything[Script Filter] Queuing argument ''
[11:16:24.646] Calculate Anything[Script Filter] Queuing argument ' '
[11:16:31.615] Calculate Anything[Script Filter] Script with argv ' ' finished
[11:16:31.618] ERROR: Calculate Anything[Script Filter] Code 255: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /Users/xxxxLibrary/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.660242C5-680D-43B5-B45C-E6BAE6A2544F/alfred/Alfred.php on line 136
[11:16:31.619] ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /Users/xxxx/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.660242C5-680D-43B5-B45C-E6BAE6A2544F/alfred/Alfred.php on line 136

System information:

  • macOS 11.3
  • Alfred 4.3.4
  • PHP 7.3.24

Changes Icon

Would you mind to change the icon (e.g. another calculator icon)?

Now it's the same as the Alfred official calculator icon and sometimes confuses me:

image

Display exchange rate conversions in multiple currencies at once

I would like to make the following suggestion for making currency conversions more useful.

Instead of showing only the base currency conversion when target currency is skipped, it would be very useful to be able to define a list of currencies to be displayed in the results apart of base currency. Of course, the base currency should be displayed first.

As an example:
typing
100 jpy

would produce the following results:

3.91 RON
1 JPY = 0.039 RON

0.82 EUR
0.92 USD
0.70 GBP
[etc]

currency calculation bug

Describe the bug
It doesn't work when I wanted to do some calculations about currency.

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred
  2. Type '100 USD to eur'
    iShot2021-04-28 22 45 25
  3. See error

Expected behavior
I want to get correct answer.

Debug Output
This is Alfred workflow debug ERROR tracking:

[22:38:24.407] ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Warning: mkdir(): No such file or directory in /Users/duke/Downloads/Alfred setting/Alfred.alfredpreferences/workflows/user.workflow.981CDA56-3355-4457-BC3C-D0E828B804A6/alfred/Alfred.php on line 358

Warning: file_put_contents(/Users/duke/Library/Application Support/Alfred/Workflow Data/com.alfred.calculateanything/cache/exchangeratehost/rates.json): failed to open stream: No such file or directory in /Users/duke/Downloads/Alfred setting/Alfred.alfredpreferences/workflows/user.workflow.981CDA56-3355-4457-BC3C-D0E828B804A6/workflow/tools/currency.php on line 606
{"items":[{"title":"82.83 EUR","subtitle":"1 USD = 0.83 EUR","arg":"82.83","icon":{"path":"assets\/flags\/EUR.png"},"mods":{"cmd":{"valid":true,"arg":82.83,"subtitle":"Action this item to copy the amount with no format"},"alt":{"valid":true,"arg":0.83,"subtitle":"Action this item to copy the value of 1 to the clipboard"}}}]}

System information:
macOS 11.3
Alfred 4.3.4
PHP 7.3.24

Besides, I try to delete formal ca-v3 and re-import newly downloaded ca-v3.alfredworkflow. It doesn't work.

calculate configure ERROR

If you have a problem with the workflow please answer the following questions.

Describe the bug
A clear and concise description of what the bug is.

calculate configure ERROR

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred '...'
  2. Type '...'
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.

Debug Output
Debug

Please enable debug (see image) open Alfred and type the conversion that it's not working, you will see that the debug window is populated with a lot of text, please paste that text in here.

[17:59:11.238] Calculate Anything[Script Filter] Queuing argument '(null)'
[17:59:11.303] Calculate Anything[Script Filter] Script with argv '(null)' finished
[17:59:11.306] STDERR: Calculate Anything[Script Filter] PHP Notice: Undefined variable: curr_name in /Users/xxx/Public/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1571C986-A554-48AB-B7BE-801131ED96B9/configure.php on line 29
[17:59:11.307] Calculate Anything[Script Filter] Notice: Undefined variable: curr_name in /Users/xxx/Public/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1571C986-A554-48AB-B7BE-801131ED96B9/configure.php on line 29
{"items": [{"title":"Set base language","subtitle":"Configure the base language: en_EN","valid":true,"arg":"language","match":"Set base language","autocomplete":null},{"title":"Add base currency","subtitle":"Set a base currency: USD","match":"Add base currency","autocomplete":"Add base currency","valid":true,"arg":"add_base_currency"},{"title":"Delete base currency","subtitle":"Delete configured base currency","match":"Delete base currency","autocomplete":"Delete base currency","valid":true,"arg":"delete_base_currency"},{"title":"Set currency locale","subtitle":"Used to give format to the value using your country format: en_US","match":"Set currency locale","autocomplete":"Set currency locale","valid":true,"arg":"locale_currency"},{"title":"Set Coinmarketcap API","subtitle":"Configure your coinmarketcap API Key: ","match":"Set Coinmarketcap API","autocomplete":"Set Coinmarketcap API","valid":true,"arg":"coinmarket_apikey"},{"title":"Set Fixer API","subtitle":"Configure your fixer API Key: ","match":"Set Fixer API","autocomplete":"Set Fixer API","valid":true,"arg":"fixer_apikey"},{"title":"Set System of Measurement","subtitle":"Define your system of measurement default to metric system: metric","match":"Set System of Measurement","autocomplete":"Set System of Measurement","valid":true,"arg":"measurement_system"},{"title":"Set VAT percentage","subtitle":"Configure your default VAT percentage: 16%","match":"Set VAT percentage","autocomplete":"Set VAT percentage","valid":true,"arg":"vat_percentage"},{"title":"Set base timezone","subtitle":"Base time zone to calculate dates in your time: America/Los_Angeles","match":"Set base timezone","autocomplete":"Set base timezone","valid":true,"arg":"time_zone"},{"title":"Add date format","subtitle":"Add date format","match":"Add date format","autocomplete":"Add date format","valid":true,"arg":"add_time_zone"},{"title":"Delete date format","subtitle":"Delete configured date format","match":"Delete date format","autocomplete":"Delete date format","valid":true,"arg":"delete_time_zone"},{"title":"Set base pixels","subtitle":"Configure the base pixels for font calculations: 16px","match":"Set base pixels","autocomplete":"Set base pixels","valid":true,"arg":"base_pixels"}] }
[17:59:11.308] ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Notice: Undefined variable: curr_name in /Users/xxx/Public/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1571C986-A554-48AB-B7BE-801131ED96B9/configure.php on line 29
{"items": [{"title":"Set base language","subtitle":"Configure the base language:

System information:

  • OS: [e.g. Mac OS 10.15.15]
  • Alfred Version [e.g. 4]
  • PHP Version - To find out the version open the Terminal.app and type: php -v
    OS:11.2.3 (20D91)
    Alfred:4.3.2
    PHP:7.4.16

Additional context
Add any other context about the problem here.

Time not converting

Latest version of the code.
I'm using the time format: j F Y g:i a and the timezone: Bucharest (3 hours difference from UTC).
"time 3pm" shows the date + "3:00 pm" ; under it there's another format showing that it's in 3 hours.
"time 3pm utc" shows the same date ("3:00 pm") yet under it it shows 6 hours.
"time utc" wrongly displays my current timezone's time (not the UTC time).

Any idea what is happening?

Alfred unable to run task after typing 'ca'

If you have a problem with the workflow please answer the following questions.

Describe the bug
I installed calculate anything to Alfred 4 on my M1 MacBook Pro. The

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred
  2. Type 'ca'
  3. See error window with
    Screenshot

Reason: launch path not accessible

It's likely that the folder required to run this task has somehow been deleted, perhaps syncing?

This error isn't that serious, just try again :)

Related Workflow Info...
Name: 'Calculate Anything'
Folder:/Users/frsr/.config/alfred/Alfred.alfredpreferences/workflows/user.workflow.5D2E604F-EBE9-4000-8297-5D37A49326F5

Expected behavior
Alfred not to freak out and to let me set language as described in README.

Debug Output
[10:01:54.290] Logging Started...
[10:01:56.882] Calculate Anything[Script Filter] Queuing argument ''

System information:

  • OS: macOS 12.0 b3
  • Alfred Version: 4
  • PHP Version: 8.0.8

Additional context
I didn't have php installed but I downloaded it with homebrew and tried again without any change.

Can not calc

If you have a problem with the workflow please answer the following questions.

Describe the bug
Basic math expression can not be calculated

like 10+12, 100 + 16%

no matter wheher the system calculater turn off or on

To Reproduce
Steps to reproduce the behavior:

  1. Open Alfred '...'
  2. Type '12 + 12'
  3. See error

Expected behavior
A clear and concise description of what you expected to happen.
Just the seach engine list, not the result

Debug Output

Please enable debug (see image) open Alfred and type the conversion that it's not working, you will see that the debug window is populated with a lot of text, please paste that text in here.

[22:27:13.437] Calculate Anything[Script Filter] Queuing argument ''
[22:27:13.523] Calculate Anything[Script Filter] Script with argv '(null)' finished
[22:27:13.525] Calculate Anything[Script Filter] {"items":[]}
[22:27:13.660] Calculate Anything[Script Filter] Queuing argument '2'
[22:27:13.732] Calculate Anything[Script Filter] Script with argv '(null)' finished
[22:27:13.734] Calculate Anything[Script Filter] {"items":[]}
[22:27:14.212] Calculate Anything[Script Filter] Queuing argument '2+'
[22:27:14.302] Calculate Anything[Script Filter] Script with argv '(null)' finished
[22:27:14.304] Calculate Anything[Script Filter] {"items":[]}
[22:27:14.687] Calculate Anything[Script Filter] Queuing argument '2+1'
[22:27:14.769] Calculate Anything[Script Filter] Script with argv '(null)' finished
[22:27:14.773] Calculate Anything[Script Filter] {"items":[]}
[22:27:14.827] Calculate Anything[Script Filter] Queuing argument '2+12'
[22:27:14.904] Calculate Anything[Script Filter] Script with argv '(null)' finished
[22:27:14.909] Calculate Anything[Script Filter] {"items":[]}

System information:

  • OS: macOS 10.15.7 (19H1217)
  • Alfred Version: 4.4.3 [1229]
  • PHP Version - To find out the version open the Terminal.app and type: php -v
PHP 7.3.11 (cli) (built: Jun  5 2020 23:50:40) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.11, Copyright (c) 1998-2018 Zend Technologies

Additional context
Add any other context about the problem here.
It seems that the Calculate Anything doesn't work at all, no matter whatever I input.

Stopped working

AFAIK I didn't touch or change anything. No matters what do I write (even copying examples from the readme) it doesn't work:

image

In Alfred everything seems okay, the workflow is there, enabled and so on. In fact, this works:

image

I'm up to date. What can it be?

Unable to

Hello.
I don't understand this problem. Do you know something about it?

CleanShot 2021-08-18 at 19 07 51@2x

Allowed memory size of 134217728 bytes exhausted

No matter what I try to calculate with CA, it will not work. According to the error long below.

[17:47:04.679] ERROR: Calculate Anything[Script Filter] Code 255: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /Users/XXXXDropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.15EFA02D-86C3-474A-81FB-FF5986D872B7/alfred/Alfred.php on line 48
[17:47:04.679] ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /Users/XXXX/Dropbox/Alfred/Alfred.alfredpreferences/workflows/user.workflow.15EFA02D-86C3-474A-81FB-FF5986D872B7/alfred/Alfred.php on line 48

it has something to do with my Dropbox. Does anyone have an idea what it could be? I tried restarting Alred, reinstalling CA etc. same error.

System information:

  • OS: Mac OS 11.4
  • Alfred Version 4.3.4
  • PHP Version PHP 7.3.24

Feature Request: convert to ft and inches

The best example is wolfram alpha:
query: 50 inches to ft and inches
returns: 4' 2"

Is there a way to do this already that I'm missing? If not, it would be really nice to add this.

Feature Request: Config option to never output workflow result numbers with commas

Personally, use this workflow more often for creating numbers that I'm plugging into code. This means having to remove the commas often. Extremely minor inconvenience but nonetheless would be lovely to have a config option telling the workflow I explicitly never want commas.

A good example where the commas get in the way a bit is for grabbing seconds for length variables and configuration of systems: "1 hr in s", "2 hours in s", "1 day in s", "1 hr in ms"

not able to convert anything

I am using the latest version of the workflow.

Describe the bug
The conversions don't work.

To Reproduce
Steps to reproduce the behavior:
In Alfred, type "100 usd in" and all the various examples mentioned in the description. None of them work (that is, I get no result or response, as if the workflow doesn't exist in Alfred)

When I type ca, I get this error below. All other workflows are working and I dont know how to fix this.

image

Debug Output
[10:04:35.729] Calculate Anything[Script Filter] Queuing argument ''
[10:04:35.762] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:35.765] ERROR: Calculate Anything[Script Filter] Code 127: Exited with error code but no message
[10:04:35.866] Calculate Anything[Script Filter] Queuing argument '0'
[10:04:35.933] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:35.937] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found
[10:04:36.100] Calculate Anything[Script Filter] Queuing argument '00'
[10:04:36.117] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:36.121] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found
[10:04:36.334] Calculate Anything[Script Filter] Queuing argument '00 '
[10:04:36.356] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:36.360] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found
[10:04:36.530] Calculate Anything[Script Filter] Queuing argument '00 u'
[10:04:36.602] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:36.609] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found
[10:04:36.662] Calculate Anything[Script Filter] Queuing argument '00 us'
[10:04:36.672] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:36.673] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found
[10:04:37.544] Calculate Anything[Script Filter] Queuing argument '00 usd'
[10:04:37.620] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:37.632] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found
[10:04:39.761] Calculate Anything[Script Filter] Queuing argument '00 usd '
[10:04:39.795] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:39.805] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found
[10:04:40.000] Calculate Anything[Script Filter] Queuing argument '00 usd i'
[10:04:40.036] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:40.048] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found
[10:04:40.106] Calculate Anything[Script Filter] Queuing argument '00 usd in'
[10:04:40.131] Calculate Anything[Script Filter] Script with argv '(null)' finished
[10:04:40.138] ERROR: Calculate Anything[Script Filter] Code 127: /bin/bash: php: command not found

System information:

  • OS: [12 monterey beta 6]
  • Alfred Version [4.5.1]

Convertion to RSD not working

Hey there, nice plugin!

Wanted to report that conversion to RSD currency is not working for some reason.

1 USD EUR works fine, 1 USD RSD doesn't.

Very very small issue with VAT

I'm setting up a new Macbook Pro M1Pro
after installing the workflow I was testing everything and VAT wasn't working.
Turns out that even that by default it's set to 16%, it didn't work, but after I hit ca and set vat it works as expected.
but if you have a fresh install the default 16% doesn't take effect

CA not triggered, but default searches...

After installing CA and configuring it, it doesn't work and only the default search actions show up. I can't find any Alfred configuration that's getting into CA's way, nor where the default/fallback searches are defined.

Any idea how to give CA priority?

C4C6009C-71FC-4BC3-BB1E-61344E197C01

Macports / PHP81 not working

Looks like PHP81 makes some problems. I am not sure if this is only CA related or if Alfred internals have some problems too.

[16:14:00.757] Logging Started...
[16:14:06.595] Calculate Anything[Script Filter] Queuing argument ''
[16:14:06.633] Calculate Anything[Script Filter] Script with argv '' finished
[16:14:06.636] ERROR: Calculate Anything[Script Filter] Code 255: Warning: preg_match_all(): Compilation failed: unrecognised compile-time option bit(s) at offset 0 in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php on line 388

Fatal error: Uncaught Error: Class "Alfred\Exception" not found in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php:391
Stack trace:
#0 /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/workflow/lib/config/configuration.php(38): Alfred\getThemeStyle()
#1 /Users/robby/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D6B13C41-660C-40D9-BD0F-0B65C735DBAD(3): require_once('/Users/robby/Dr...')
#2 {main}
  thrown in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php on line 391
[16:14:06.637] ERROR: Calculate Anything[Script Filter] JSON error: JSON text did not start with array or object and option to allow fragments not set. around line 1, column 0. in JSON:
Warning: preg_match_all(): Compilation failed: unrecognised compile-time option bit(s) at offset 0 in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php on line 388

Fatal error: Uncaught Error: Class "Alfred\Exception" not found in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php:391
Stack trace:
#0 /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/workflow/lib/config/configuration.php(38): Alfred\getThemeStyle()
#1 /Users/robby/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D6B13C41-660C-40D9-BD0F-0B65C735DBAD(3): require_once('/Users/robby/Dr...')
#2 {main}
  thrown in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php on line 391
[16:14:14.605] Calculate Anything[Script Filter] Queuing argument ' '
[16:14:14.634] Calculate Anything[Script Filter] Script with argv ' ' finished
[16:14:14.638] ERROR: Calculate Anything[Script Filter] Code 255: Warning: preg_match_all(): Compilation failed: unrecognised compile-time option bit(s) at offset 0 in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php on line 388

Fatal error: Uncaught Error: Class "Alfred\Exception" not found in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php:391
Stack trace:
#0 /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/workflow/lib/config/configuration.php(38): Alfred\getThemeStyle()
#1 /Users/robby/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D6B13C41-660C-40D9-BD0F-0B65C735DBAD(3): require_once('/Users/robby/Dr...')
#2 {main}
  thrown in /Users/robby/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.989E62B9-BBC3-4E35-B13C-7359602320C8/alfred/Alfred.php on line 391

Installing and selecting PHP74 makes everything work again:

  • sudo port install php74
  • sudo port select php php74
  • php --version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.