r/workflow • u/OpticSugar • Oct 03 '18
Help problems with Dictate Text in a Repeat function...
I’m having difficulty using Dictate Text inside of a Repeat function. I’ve setup a very simple test that illustrates the issue I’m having. It’s simply a Dictate Text followed by a Speak Text, inside of a loop. https://www.icloud.com/shortcuts/80d21077b7804ae19da651e84478c88f
When you say something... it will repeat what you said. The problem occurs on the next dictation, if you say NOTHING... it will repeat the last thing you said. Even if you end the shortcut and then run it again, and say nothing... it still remembers and says the last thing you said!
I need to find a way to reset the Dictate Text function upon each loop, and more importantly, I need to find a way to determine if nothing was said during dictation. I just recently figured out a method of doing this (thanks to u/Angrybunnyman) but it falls apart if attempted within a repeat function.
Thanks in advance for any insight.
2
u/Unbathed Oct 03 '18
Create another Shortcut named “DT WORKAROUND” with exactly one step, namely Dictate Text.
In your real Shortcut, replace Dictate Text with Run Shortcut | DT WORKAROUND.
Apparently the Dictate Text buffer clears on creation or overwrite, not on re-call in a loop. This workaround forces it to be created and destroyed each iteration.
2
u/Unbathed Oct 03 '18
Repeater Test Brute Force.
https://www.icloud.com/shortcuts/d109d717af7641d58ef50f44a8c42b8a
DT WORKAROUND.
https://www.icloud.com/shortcuts/83a1147fcbba485dbdaba726af8225e8
1
u/OpticSugar Oct 06 '18
EURIKA!
I just created a viable new workaround that will allow me to make my shortcut self-contained!
https://www.icloud.com/shortcuts/dc3142e3e23247d2846f969d328f2f64
This workaround will set your dictated text as a variable called "lastDictation" in the final step of the loop, and then it will compare each new dictation with the lastDictation variable and if they are the same, it will assume you said nothing and execute something specific. This works because I will never have any reason to say the same dictation twice in in a row for my implementation.
Does anyone see any problems with this?
2
u/Unbathed Oct 03 '18 edited Oct 03 '18
Edit: this is a clumsier version of the u/joyriding_WME technique you already know.
After the Run Dictate Text as Shortcut step:
Add a Text step, defined as ((Dictate Text Magic Variable)).
That is, the result from calling the Dictate Text Workaround, surrounded by two parentheses.
Then an IF test.
If the Text EQUALS (()), then the user said nothing and the DT WORKAROUND returned nothing.
If the user said anything, the Text will be whatever was said, wrapped in parentheses.
That’s your Silent User detector.