Organizing Long Snippet Contents

Hello Blazers!

I'd love to get some guidance from the community here on something I am trying to do. I am sure it is easy and I am just overthinking it. Here goes. I have a snippet (below) that ultimately will contain approximately 98 If Statements. Yes....98! With this many If Statements, I feel it would be more efficient to create and maintain if I could have each If Statement on a separate line. The problem is, when I hit the key to go to the next line, that breaks the AutoPilot. So far, I have created 19 of the 98 If Statements and the only way I can get this to work is if I write the Snippet without the key line breaks. This is what is embedded below. Love to hear some ideas on a solution to this problem. Thank you!

{clipboard}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{key: enter}{wait: delay=+.1s}{key: downarrow}{wait: delay=+.1s}{key: downarrow}{wait: delay=+.1s}{key: enter}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{key: tab}{wait: delay=+.3s}Student Liaisons A2P{wait: delay=+.3s}{key: downarrow}{wait: delay=+.3s}{key: enter}{wait: delay=+.3s}{key: tab}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{key: downarrow}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{click}{wait: delay=+.1s}{key: shift-tab}{wait: delay=+.1s}{key: downarrow}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{click}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{key: tab}{wait: delay=+.1s}{key: s}{key: t}{key: u}{wait: delay=+.1s}{key: enter}{wait: delay=+.2s}{key: tab}{key: tab}{if: contains({clipboard}, "20 Day - VA Yes")}{key: 2}{key: 0}{key: downarrow}{key: enter}{endif}{if: contains({clipboard}, "20 Day - VA No")}{key: 2}{key: 0}{key: enter}{endif}{if: contains({clipboard}, "18 Day - VA Yes")}{key: 1}{key: 8}{key: downarrow}{key: enter}{endif}{if: contains({clipboard}, "18 Day - VA No")}{key: 1}{key: 8}{key: enter}{endif}{if: contains({clipboard}, "14 Day - VA Yes")}{key: 1}{key: 4}{key: downarrow}{key: enter}{endif}{if: contains({clipboard}, "14 Day - VA No")}{key: 1}{key: 4}{key: enter}{endif}{if: contains({clipboard}, "10 Day - VA Yes")}{key: 1}{key: 0}{key: downarrow}{key: enter}{endif}{if: contains({clipboard}, "10 Day - VA No")}{key: 1}{key: 0}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_8 Day")}{key: 8}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_ERTA - Before Start FSP - Orientation Complete")}{key: e}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_ Day 1 Inst Flag Text")}{key: d}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_21 Day MIA - Drop")}{key: 2}{key: 1}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_21 Day MIA - Re-Entry")}{key: 2}{key: 1}{repeat: 2}{key: downarrow}{endrepeat}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_21 Day MIA - TOR")}{key: 2}{key: 1}{repeat: 3}{key: downarrow}{endrepeat}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_21 Day MIA - VA")}{key: 2}{key: 1}{repeat: 4}{key: downarrow}{endrepeat}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_21 Day MIA - V Drop")}{key: 2}{key: 1}{repeat: 5}{key: downarrow}{endrepeat}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_22 Day MIA - VA")}{key: 2}{key: 2}{repeat: 4}{key: downarrow}{endrepeat}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_22 Day MIA - TOR")}{key: 2}{key: 2}{repeat: 3}{key: downarrow}{endrepeat}{key: enter}{endif}{if: contains({clipboard}, "SL_A2P_22 Day MIA - Drop")}{key: 2}{key: 2}{key: enter}{endif}{repeat: 4}{key: tab}{endrepeat}0{repeat: 5}{key: tab}{endrepeat}{wait: delay=+.2s}ce sms{wait: delay=+.8s}{key: downarrow}{wait: delay=+.8s}{key: enter}{wait: delay=+.1s}{repeat: 9}{key: shift-tab}{endrepeat}

Keep Blazing :fire:,
-Brad

Hi @Brad_Hedinger,

Rather than "fix" the snippet, I think it would be best to share some ideas with you on how to optimize your snippets in general.

So, here are my thoughts:

  1. If a snippet is becoming huge, you probably should break it up into multiple snippets with their respective shortcuts. For instance, when I'm publishing videos in Youtube, I need to fill in the description and the tags. If I were to do it with a single snippet, I'd have to use a bunch of tab keys to travel between the fields. Instead, I just made two snippets. Remember, Text Blaze should be serving you, not the other way around.
  2. Use the repeat command when using multiple repetitions of the same thing command. You can read about it here.
  3. Tying in with point number 1, rather than having all of the data in the same snippet, you could create multiple "partial" snippets that you would then insert into the main snippet. Any variables you use in those imported snippets would also work in the main snippet.
  4. Use trim to make your snippets easier to read.
  5. Practice economizing with your {if} commands.

Below, you can see part of your snippet with some of the above concepts applied. In particular, pay attention to how I used a nested {if} command to make the {key: downarrow} only show up if there's a "Yes" included.

{formmenu: name=data;
18 Day - VA Yes;
18 Day - VA No;
14 Day - VA Yes;
14 Day - VA No;
10 Day - VA Yes;
10 Day - VA No}

{if: contains(data, "18 Day - VA"); trim=right}
{key: 1}{key: 8}{if: contains(data, "Yes")}{key: downarrow}{endif}{key: enter}{endif: trim=right}
{if: contains(data, "14 Day - VA"); trim=right}
{key: 1}{key: 4}{if: contains(data, "Yes")}{key: downarrow}{endif}{key: enter}{endif: trim=right}
{if: contains(data, "10 Day - VA"); trim=right}
{key: 1}{key: 0}{if: contains(data, "Yes")}{key: downarrow}{endif}{key: enter}{endif: trim=right}

There's a lot to unpack here, and remember, Text Blaze can be as advanced and powerful as you want it to be. Delving into the more advanced features takes some acclimatization. But that's why we're here :slight_smile:

2 Likes

Thank you @Cedric_Debono_Blaze! Your advice makes sense in theory. The issue I encounter completely revolves around this being a Snippet I run in Salesforce, and the clipboard data comes from a big Excel workbook coupled with several flows I built in MS Power Automate that creates specific .csv files every day according to what is needed for that day. That big workbook has cells that change their contents daily depending on the date. That drives the .csv file creation via Power Automate. From there, I populate each .csv file with data from various sources. Then, I have to import those .csv files into Salesforce. The cell I copy contains contents and formatting that change daily and must be pasted into a field within Salesforce. That's why I went with the path of using the Clipboard to copy the Excel cell contents, then using the contents of the Clipboard to to drive the Autopilot steps that choose a specific item from a dropdown menu in Salesforce as part of the file import process based on what was pasted from the clipboard right off the top. :crazy_face:

Maybe we can look at this together sometime?

Sure thing :slight_smile:

Drop me an email and let's have a call.

1 Like

Thank you @Cedric_Debono_Blaze! I am traveling until Monday 5/2 so I will reach out to you then so we can connect. Looking forward to the time with you!

@Brad_Hedinger - safe travels :slight_smile:

{note}
{endnote}

Might solve the problem visually.