Log Weight to Health Via Voice
COMMENT
By /u/dmetzcher
v.1.0
This shortcut asks for your weight and logs it to the Health database. This is all done via voice. Some error checking is included, and the weight will be confirmed before writing it to the database.
COMMENT
Modify all Dictate Text steps to use your own language. You may also change the Speak Text steps to the Siri language/accent you prefer when Siri speaks to you.
COMMENT
We use the Continue Shortcut in App step to stop Siri from saying the first Speak Text step in the default voice and all subsequent Speak Text steps in the voice used in those steps. This forces Siri to go straight to the Shortcuts app and run everything from there.
SCRIPTING
Continue in Shortcuts app
TEXT
How much do you weigh?

Text
DOCUMENTS
Speak
Text
Language
English (United Kingdom)
DOCUMENTS
Dictate Text
Stop Listening
After Pause

Dictated Text
VARIABLES
Set variable
weight
to
Input
TEXT
And fat?

Text
DOCUMENTS
Speak
Text
Language
English (United States)
DOCUMENTS
Dictate Text
Stop Listening
After Pause

Dictated Text
VARIABLES
Set variable
fat
to
Input
COMMENT
If nothing is said or if anything other than a number is spoken, the number received will be zero. These steps deal with that scenario.
NUMBER
weight

Number
SCRIPTING
If
Input
Condition
TEXT
I did not understand what you said. You must speak the number—and only the number. Whole numbers and decimals are fine. Would you like to try again?

Text
DOCUMENTS
Speak
Text
Language
English (United Kingdom)
DOCUMENTS
Dictate Text
Stop Listening
After Pause

Dictated Text
SCRIPTING
If
Input
Condition
SHORTCUTS
Run
Log Weight to Health Via Voice

Shortcut Result
SCRIPTING
Exit shortcut with
Result
SCRIPTING
Otherwise
SCRIPTING
Exit shortcut with
Result
SCRIPTING
End If

If Result
SCRIPTING
Otherwise
SCRIPTING
End If

If Result
TEXT
fat
kilograms and
weight
percent fat. Is that correct?

Text
DOCUMENTS
Speak
Text
Language
English (United Kingdom)
DOCUMENTS
Dictate Text
Stop Listening
After Pause

Dictated Text
SCRIPTING
If
Input
Condition
HEALTH
Log Health Sample
Options Under Construction

Health Sample
HEALTH
Log Health Sample
Options Under Construction

Health Sample
TEXT
Done. Your weight has been logged as
weight
kilograms and your fat as
fat
%. I have opened the health app to show you.

Text
DOCUMENTS
Speak
Text
Language
English (United Kingdom)
MISSING
Open _ActivityBreadcrumbKey_TabBarSetTabActivityKey#kActivityTransitionToDisplayTypeKey_DisplayActionActivityKey
SCRIPTING
Otherwise
TEXT
Would you like to try again?

Text
DOCUMENTS
Speak
Text
Language
English (United Kingdom)
DOCUMENTS
Dictate Text
Stop Listening
After Pause

Dictated Text
SCRIPTING
If
Input
Condition
SHORTCUTS
Run
Log Weight to Health Via Voice

Shortcut Result
SCRIPTING
Otherwise
SCRIPTING
Exit shortcut with
Result
SCRIPTING
End If

If Result
SCRIPTING
End If

If Result
SCRIPTING
Exit shortcut with
Result
Showcuts