Limit number of words spoken

Joined: April 19th, 2018, 2:36 pm

May 16th, 2018, 8:10 pm #1

Whenever I have my headphones in, I have a macro that reads my important notifications. Unfortunately, there are some notification titles that are huge and the nice British lady ends up droning on for minutes. Any way to stop after 20 words?

Sent from my Pixel 2 XL using Tapatalk

Quote
Like
Share

Joined: December 30th, 2017, 4:00 pm

May 17th, 2018, 12:01 am #2

Try this:
- Text Manipulation action
- Extract Text
- Source text = the string variable containing the text from your notification
- Text to match (regex) = (\W*\w+(?:\W+\w+){0,19})
- Save to variable = the string variable your macro will speak
Quote
Like
Share

Joined: April 19th, 2018, 2:36 pm

May 17th, 2018, 12:36 am #3

pseudocyclic wrote:Try this:
- Text Manipulation action
- Extract Text
- Source text = the string variable containing the text from your notification
- Text to match (regex) = (\W*\w+(?:\W+\w+){0,19})
- Save to variable = the string variable your macro will speak
Took a bit to figure out the regex and use of variables but it worked!!! Can you explain exactly what the syntax of your regex does?

XfMWr72.jpeg
Quote
Like
Share

Joined: December 23rd, 2013, 5:55 pm

May 17th, 2018, 4:50 am #4

Google it ..
If you like the blues: get a video of SBWII, the best Blues Harmonica player ever, here:

https://www.dropbox.com/s/tyvblfwhiy81p ... 2.avi?dl=0

If you liked it, pls share!
Quote
Like
Share

Joined: April 19th, 2018, 2:36 pm

May 17th, 2018, 4:58 am #5

wolfgangt wrote:Google it ..
I spent half an hour looking over regex syntax, which I was totally unaware of before today, and still have a few questions about what each variable does. If pseudocyclic is too busy to reply, I will be content with the help he/she has given. Your unhelpful comment, regarding a post not directed at you... not so much.
Quote
Like
Share

Joined: December 30th, 2017, 4:00 pm

May 17th, 2018, 1:12 pm #6

Dan_Rhodes wrote:
pseudocyclic wrote:Try this:
- Text Manipulation action
- Extract Text
- Source text = the string variable containing the text from your notification
- Text to match (regex) = (\W*\w+(?:\W+\w+){0,19})
- Save to variable = the string variable your macro will speak
Took a bit to figure out the regex and use of variables but it worked!!!  Can you explain exactly what the syntax of your regex does?
(\W*\w+(?:\W+\w+){0,19})

( capturing group
\W* ≥0 non-word character(s)
\w+ >0 word character(s)
(?: non-capturing group
\W+ >0 non-word character(s)
\w+ >0 word character(s)
)
{0,19} how many times
)

http://www.rexegg.com/regex-quickstart.html
Quote
Like
Share