Condition Based on User's Location, PC Name, Timezone, etc

Hey everyone! Once again I turn to your expertise to try to make my life easier.

I have dozens of snippets I use for work under our main work account. We are 3 people on the team and we each have our signature, which we use the shortcode /d1 (that's me, Daniel), /t1 or /r1, depending on the user.

Is there a way to include this signature at the end of the snippet depending on who is sending it?

For example, can it detect that I am sending the snippet and add the {import: /d1} and not the other 2 based on a condition?

The 3 of us are in different countries and time zones. Perhaps that is a way to differentiate it? Or a condition based on the computer name? Any ideas on how to accomplish this would be very welcome.

Hi! You could probably do it like this? :blush:

{if: contains({user: email}, "Daniel")}Daniels signature{elseif: contains({user: email}, "Ronaldo")}Ronaldos signature{else}The last guys signature{endif}

2 Likes

Hi Benjamin. I don't think this would work as the TextBlaze account is shared between the 3 of us, under the support e-mail address. We don't use individual accounts.

Unless you are referring to a different "user". Where would that user information be populated from?

Oh I see. You say that the three of you are located in different countries - are there different languages aswell? How about these two options

{if: contains({site: text}, "æøå")}Daniels signature {elseif: contains({site: text}, "espanõl")}Ronaldos signature{else}The other guys signature{endif}

{if: contains(extractedcountry, "Norway")}Daniels signature{elseif: contains(extractedcountry, "Spain")}Ronaldos signature{else}The other guys signature{endif}

{note: preview=no}{urlload: https://whatismycountry.com/; done=(contents)->["contents": contents]; method=GET}{extractedcountry=extractregex(contents, "h2 id=\"country\">(Your country is \D+)</h2>")}{endnote}

3 Likes

Hi Benjamin.

The second option worked great. However, if I import it to a snippet, when I try calling the snippet it opens a pop-up window with the snippet text an Insert button. My signature is correctly showing there, but is there a way for it not to open this pop-up and simply insert it without this confirmation step?

1 Like

Hi again,

Thats great! I don't think it's possible to skip the inserting step, as the pop-up happens due to the HTML-GET command, even if it's hidden. When you trigger the snippet, you could sometimes see that the extractregex shows an error before the webpage has loaded.
@Gaurang_Tandon could perhaps confirm this?

However, I would suggest (if possible) is to integrate the signature in another snippet that you regularely use, maybe like this?

Hi {formtext: name=name},

{formmenu: default=Thank you for contacting us.; Thanks for the call!; I hope you had a good weekend.}

{cursor}

{formmenu: default=Don't hesitate to contact us again if you have any more questions.; I'll await your reply before pursuing this issue further.}
{if: {time: E} = 5 or {time: E} = 6 or {time: E} = 7}
Have a great weekend! {else}
Have a great day!{endif}

{note: preview=no}{urlload: https://whatismycountry.com/; done=(contents)->["contents": contents]; method=GET}
{extractedcountry=extractregex(contents, "h2 id=\"country\">(Your country is \D+)</h2>")}{endnote}{if: contains(extractedcountry, "Norway")}Daniels signature{elseif: contains(extractedcountry, "Spain")}Ronaldos signature{elseif: contains(extractedcountry, "Malaga")}The other guys signature{endif}

Hi Benjamin.

Thank you for the reply once again. I thought about integrating the signature straight into the snippet but I really want to avoid this. We have images in the signature and adding them to each snippet (we have a couple hundred) would make everything look so messy. I really like adding the signature into its own snippet so I can just have {import: $signature} at the end of the snippets.

Imagine if I am away from my home country for a week and need to update the country in the list, I would need to update all of the snippets, one by one. Or if we have a new customer service rep, or if one of the current reps leaves, etc... there are so many scenarios.

Is there any other solution that you can think of? Unfortunately, having the confirmation pop-up is a deal breaker as it slows efficiency down so much.

Hi again,

You're welcome :blush: I'm sorry but I can't come up with a way to work around this other than you having different users (as then you could easily use the {user: email} command.

By the way incase you're not aware, you can easily confirm the popup by hitting enter (so you don't have to use your mouse to click each time), this could probably speed it up a notch.

Hey Benjamin. Thank you for trying. I will see if I can find another way to accomplish this where the pop-up doesn't... well, pop-up.

Thank you nonetheless! Have a great day.

1 Like

Hey again,

I actually found a way to bypass the pop-up, but it requires a "setup" at first.
The setup to go to https://write-box.appspot.com/ and write your name in the textbox.
You need to keep a single instance of this tab open at all times.

{if: contains(extractedname, "Daniel")}Daniels signature{elseif: contains(extractedname, "Ronaldo")}Ronaldos signature{elseif: contains(extractedname, "Someone else")}The other guys signature{endif}{note: preview=no}{extractedname={site: text; page=https://write-box.appspot.com/*; select=ifneeded; selector=#editor}}{endnote}

1 Like

Thanks again Benjamin. I will play around with this and see if it works for what I need.

Quick question. If we are each logged into our own Chrome profile, under own e-mail address, is there a way for TextBlaze to use that information? If so, what would be the variable for this?

1 Like

Hi @Support_Goodness_Lov,

You can use our {user} command for that.

1 Like

You're welcome!

If I understand you correctly then no, I don't think so.
@Ashwin_Mittal1 I believe they all share a single Textblaze account, so {user} won't work.

Thanks @benjamin.tolfsen for letting me know. I think in that case it is not possible for an extension to get the current Chrome profile information.

@Support_Goodness_Lov, I want to recommend you try our business plan better team management, improved sharing, and much more like support for commands like {user}. It might be a good fit for your use case, so please take a look here to learn more.

1 Like

Thank you, Benjamin and Ashwin. I will definitely look into the Business plan, as it might be an easier solution.