Using new Capitalize Command Pack with imported snippets

Hi there!

It's any chance of use the new Capitalize Command Pack with {import: /snippet}?

I have a snippet to obtain the name from the page, but I need to capitalize the first character.



What kind of snippet are you using to get the name?

Hi Cedric!

Is a extractregex + site formula, like this:


{=extractregex({site:html; frame=top; selector=#mainGeneric > div > > > > > > > div:nth-child(3) > div:nth-child(1) > a > b; multiple=yes}, "(\w+)")}

My idea is to import .autoname, capitalizing with the format Abcdfg.

Right. At this point in time, we don't support the use of the import command inside formulas. But you could use the proper() function on the first word. Unfortunately, proper() capitalizes the first letter of every word, so you need to make it so that only the first word gets it. You could do that with extractregex. It's a but cumbersome but doable.

Here's how proper() works:

{=proper("the quick brown fox jumped over the lazy dogs")}

Or alternatively:

{text="the quick brown fox jumped over the lazy dogs"}

And here's the whole thing with the regex:

{text="the quick brown fox jumped over the lazy dogs"; trim=yes}
{firstword=extractregex(text, "\w+"); trim=yes}
{rest=extractregex(text, firstword&"([\D\S]+)"); trim=yes}

Absolutely amazing Cedric!

I'm receiving only 1 word with the snippet, so "=proper" is going to work perfect.

I already said, you are my hero.