Apple Shortcuts is unable to transform text in number when coming from KM

Hello,

I’m having trouble in executing an Apple Shortcut from KM. The shortcut itself works fine when I execute by itself and I type a number in the input shortcut field. However, I cannot pass “1” from KM and being interpreted as an error. I get an error saying something like Shortcuts couldn’t transform text into a number.

How can I make this work?

By showing rather than telling.

This is what I did. The interface of Apple Shortcuts is in Portuguese, but basically the notification says “Obtain list item failed because Shortcuts couldn’t convert “Text” into “Number”. As you see, I passed the text “1” to the shortcut input, but I got this error. If I execute the the shortcut directly, and ask for prompt if no input is given, and then type “1”, the shortcut behaves correctly.

It doesn’t make a diference if I choose “Calculation” or “Text” in KM.

Thanks.

Keyboard Maestro always sends your input as text. In this case, the text will be the string “1” (no quotes).

If Shortcuts is incapable of converting that to a number 1, then you will need some sort of Shortcuts action that processes text and returns a number. Perhaps something that calculates the value of an expression?

Shortcuts has a Get Numbers from Input action.

Something like Obter números da entrada ?

1 Like

I tried it. Also tried this: to make a simple shortcut to show KM input data. It looks like it receives a file, not text, so it can’t process it.

I don’t know how to proceed. Is it supposed to be like this?

This doesn’t work either:

I get “No”

You are sure that the string is getting to Shortcuts ?

It looks as if KM sends a file, named “data”, instead of the string itself, or that Shortcuts converts into a file. If I try to save that file, it saves a file named “data” whose contents are “1”

Are these examples working on your system ?

Thanks! The first one does. However, there was a hint that pointed me in the right direction:

It looks it’s not only “0”, but also “1”, “2”, etc. However, if I type “01”, the shortcut works as intended.

Definitely a bug. I don’t know where the bug lies, but @_jims suggests it lies in the Shortcuts app.

By the way, and this is relevant and should have stated it earlier: I’m using macOS 15.7.4 (Sequoia)..

1 Like

Every version of macOS Shortcuts is a new adventure. :zany_face:

2 Likes