How can i add all match from action designer?

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
123
Благодарностей
33
Баллы
28
Hello Zenno friends,

How to get all the match from an action designer?
I can get only one match...

I checked from the different option here :
and "all" looks like don't work witch Match in Action Properties...
So i made systeme with a loop and a increment of 1 to get all the match...

Is there a better way?

113768



The idea of get all the match is because :
I use the Wordpress extension TranslatePress What i want is to get all the other language url from a page from the bottom button
113767


and open it with zeno because for translate a page it need to be open one time first.
So for the moment when i create article i give him a list of url and Zenno will open each language url of my website for the translation and when there is more match to check, it got to a new url.


for instance the code is like this ( not my website)
HTML:
<div id="trp-floater-ls" onclick="" data-no-translation class="trp-language-switcher-container trp-floater-ls-names trp-bottom-right trp-color-dark flags-full-names" >
            <div id="trp-floater-ls-current-language" class="trp-with-flags">

                <a href="#" class="trp-floater-ls-disabled-language trp-ls-disabled-language" onclick="event.preventDefault()">
                    <noscript><img class="trp-flag-image" src="https://www.pcs-electronics.com/wp-content/plugins/translatepress-multilingual/assets/images/flags/en_US.png" width="18" height="12" alt="en_US" title="English"></noscript><img class="lazyload trp-flag-image" src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2018%2012%22%3E%3C/svg%3E' data-src="https://www.pcs-electronics.com/wp-content/plugins/translatepress-multilingual/assets/images/flags/en_US.png" width="18" height="12" alt="en_US" title="English">English                </a>

            </div>
            <div id="trp-floater-ls-language-list" class="trp-with-flags" >

                <div class="trp-language-wrap"  style="padding: 11px;">                    <a href="https://www.pcs-electronics.com/sl/"
                         title="Slovenščina">
                                    <noscript><img class="trp-flag-image" src="https://www.pcs-electronics.com/wp-content/plugins/translatepress-multilingual/assets/images/flags/sl_SI.png" width="18" height="12" alt="sl_SI" title="Slovenščina"></noscript><img class="lazyload trp-flag-image" src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2018%2012%22%3E%3C/svg%3E' data-src="https://www.pcs-electronics.com/wp-content/plugins/translatepress-multilingual/assets/images/flags/sl_SI.png" width="18" height="12" alt="sl_SI" title="Slovenščina">Slovenščina                              </a>
                                    <a href="https://www.pcs-electronics.com/es/"
                         title="Español">
                                    <noscript><img class="trp-flag-image" src="https://www.pcs-electronics.com/wp-content/plugins/translatepress-multilingual/assets/images/flags/es_ES.png" width="18" height="12" alt="es_ES" title="Español"></noscript><img class="lazyload trp-flag-image" src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2018%2012%22%3E%3C/svg%3E' data-src="https://www.pcs-electronics.com/wp-content/plugins/translatepress-multilingual/assets/images/flags/es_ES.png" width="18" height="12" alt="es_ES" title="Español">Español                              </a>
                                    <a href="https://www.pcs-electronics.com/de/"
                         title="Deutsch">
                                    <noscript><img class="trp-flag-image" src="https://www.pcs-electronics.com/wp-content/plugins/translatepress-multilingual/assets/images/flags/de_DE.png" width="18" height="12" alt="de_DE" title="Deutsch"></noscript><img class="lazyload trp-flag-image" src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%2018%2012%22%3E%3C/svg%3E' data-src="https://www.pcs-electronics.com/wp-content/plugins/translatepress-multilingual/assets/images/flags/de_DE.png" width="18" height="12" alt="de_DE" title="Deutsch">Deutsch                              </a>
                                    <a href="https://www.pcs-electronics.com/fr/"
                         title="Français">
I use the Attribute Name "title" get each "href
113769

Thank by advance for your help!
 
Последнее редактирование:

myndeswx

Client
Регистрация
15.05.2017
Сообщения
406
Благодарностей
92
Баллы
28
You can simply regex the {-Page.Source-}
working with the regex helper alone you already get almost perfect result, to get rid of the first result you can fine tune the regex a bit more manually, in this case to include only {2,3} lovercase letters and /

Full regex-
(?<=<a\ href=")https://www\.pcs-electronics\.com/.*?/(?="\ title=")
113772
 
  • Спасибо
Реакции: Pierre Paul Jacques

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
123
Благодарностей
33
Баллы
28
OMG you are a the Boss!
Thank very much i appreciated a lot,
it work perfectly in this way!


Just to confirm is not possible by action designer to get the value of different match?
 
  • Спасибо
Реакции: myndeswx

myndeswx

Client
Регистрация
15.05.2017
Сообщения
406
Благодарностей
92
Баллы
28
OMG you are a the Boss!
Thank very much i appreciated a lot,
it work perfectly in this way!


Just to confirm is not possible by action designer to get the value of different match?
You're welcome, and no, as far as I know only possible to get the collection through C# , you can also use this little tool, that basically does what we just did with regex but all automatically, but it does not seem to work with your website.
113785
 
  • Спасибо
Реакции: Pierre Paul Jacques

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
123
Благодарностей
33
Баллы
28
You're welcome, and no, as far as I know only possible to get the collection through C# , you can also use this little tool, that basically does what we just did with regex but all automatically, but it does not seem to work with your website.Посмотреть вложение 113785
Yes effectively i try this tool first and sometime is magical it got the result you want,
but in the particular case it didn't work well
 

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
123
Благодарностей
33
Баллы
28
Everyday i discover more thing with Zenno!

For each url i will put them in variable (Y1, Y2...) and ask by C# to open one,
myndeswx i used the C# code you gave me in the other other thread,)

Thank again


113788

113789
 
  • Спасибо
Реакции: myndeswx

myndeswx

Client
Регистрация
15.05.2017
Сообщения
406
Благодарностей
92
Баллы
28
There are about 40 languages, putting each of them to variables will be hard work, and we don't like hard work :- ) you can just use C# to iterate through that list and open everything up (if your PC does not get on fire)

C#:
//our list that we just made with regex
var list = project.Lists["regex"];


if (list != null && list.Count > 0)
{
    // Iterate through the list
    for (int i = 0; i < list.Count; i++)
    {
        // Get the current item from the list
        var currentItem = list[i];

        Tab tab = instance.NewTab(i.ToString());
        tab.Navigate(currentItem.ToString());
    }
}
Also updated regex to just get all URLs with 2 letters and slash after domain
(?<=href=")https://www\.pcs-electronics\.com/[a-z]{2,3}/(?=">)

Have fun, and remember you can use chat gippity to help with zenno C# code : )
 
  • Спасибо
Реакции: Pierre Paul Jacques

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
123
Благодарностей
33
Баллы
28
OMG you are Wizard of C#!
You made everything more simple and efficient!!!



I use GPT for C# but many time it don't work because it don't keep in mind that zenno got his own way to works,
so i copy/paste some ressource from https://zennolab.atlassian.net/

Just by curiosity how do you know so much? did you study Code/Programmation?
 
  • Спасибо
Реакции: myndeswx

myndeswx

Client
Регистрация
15.05.2017
Сообщения
406
Благодарностей
92
Баллы
28
That's how it should be when automating! :ar:
Yes, I have seen it likes to include some C# code that does not exist in zp, but after tidying it up a bit it's definitely possible to get some good examples, always use 'write zennoposter code' and not C# code, you can also post the code snippets from https://zennolab.atlassian.net/ and ask it to adjust for your task.
No, I did not study coding, and I am not good with C#, my motto is just to learn the bare minimum you need for a task, so will you on your zp journey :- )
 
  • Спасибо
Реакции: Pierre Paul Jacques

Pierre Paul Jacques

Активный пользователь
Регистрация
08.10.2023
Сообщения
123
Благодарностей
33
Баллы
28
"is just to learn the bare minimum you need for a task, so will you on your zp journey :- ) "
You right that the best way! Pareto,)

Now with GPT technical thing become more accesible!
 
  • Спасибо
Реакции: myndeswx

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)