111
October 15, 2019, 12:11pm
1
scott
October 15, 2019, 12:32pm
2
You can use the {site} command to information from the site you are on:
In the case of Gmail you should be able to find the name of the author of the email you are replying to using the following CSS selector:
Hello {site: text; selector=.h7:last-child .gD},
...
Note the error message above about "No match" is because the example snippet naturally can't find the name when running in the community forums.
If you wanted just the first name, you could split the string on the spaces and take just the first item like so:
Hello {=split({site: text; selector=.h7:last-child .gD}, " ")[1]},
...
2 Likes
Cool stuff. I really need to learn more about these selectors.
111
October 18, 2019, 9:19am
4
How can I find a selector on another website by myself?
scott
October 18, 2019, 12:24pm
5
There are a number of resources available to help determine a CSS selector.
As background you might want to start with this overview of what CSS selectors are:
In CSS, selectors are used to target the HTML elements on our web pages that we want to style. There are a wide variety of CSS selectors available, allowing for fine-grained precision when selecting elements to style. In this article and its...
Here is a brief video of an approach to getting a selector using the tools built into Chrome:
Here are two different Chrome Extensions that can help you get a selector:
If you have any specific cases you need help with, feel free to post to these forums
2 Likes
Is this possible for a new email (as opposed to a "reply?")
Hi @John_Gay ,
With a little bit (ok ok, a LOT hehe) of help from @scott , here you go:
{strip_address=(txt) -> replaceregex(txt, "(.*$", ""); trim=yes}{fullname=trim(catch(strip_address({site: text; selector=.nH:focus-within .aDm}), catch(strip_address({site: text; selector=.h7:last-child .gD}), default)))}{=split(fullname, " ")[1]}
The last bit is what selects just the first name:
{=split(fullname, " ")[1]}
It's taking the contents of fullname
, splitting them by spaces, and then giving you the first piece of the result. So if you were to change the number in the square brackets to 2
, it would give you the second part.
Look at the example below:
{fullname="John Paul Jones"}
The first name is {=split(fullname, " ")[1]}
The second name is {=split(fullname, " ")[2]}
The last name is {=split(fullname, " ")[3]}
1 Like
biuro
March 13, 2021, 11:28am
8
Cannot preview {site} commands
HI @biuro ,
The {site}
command won't preview in the forums, but if you copy that snippet into your dashboard and use it in gmail it will work correctly.
biuro
March 13, 2021, 12:59pm
10
Take a look into the screenshots, Thanks
You won't see it in the dashboard preview either. That's only going to work when replying to an email in gmail. Try it when replying to an email in gmail.