Can't check for presence of text specified as variable

MisterP

Пользователь
Регистрация
08.02.2014
Сообщения
87
Благодарностей
0
Баллы
6
Hey there,
I want to use the "Check presence of text" but I want to specify a variable instead of a plain text. It doesn't work (in the regex field).

Also, when I type in any message that has a ")" for instnace "this is a text :-)" it will give out an error.
I was thinking of having an built-in plain text to regex converter within c# (can't code c sharp) but that still wouldn't solve the problem with wanting to search for {-Variable.Text-}

How can I solve this?
 

MisterP

Пользователь
Регистрация
08.02.2014
Сообщения
87
Благодарностей
0
Баллы
6
No one can help? :(
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
I guess no one can understand what you mean.
Try to explain with some examples... As by now its really not clear what you asking for
 
  • Спасибо
Реакции: britalic

MisterP

Пользователь
Регистрация
08.02.2014
Сообщения
87
Благодарностей
0
Баллы
6
Ah ok. Alright, so lets say my bot has a text field where the user can specify something. For instance he enters in the text box "this is a test ;-)"

What I want ZennoPoster to do then is to search for "this is a test ;-)" within a certain website. It doesn't work though because the text to look for has an ")" in it!

Try the feature "Check presence of text" within zennoposter and enter in the regex field something like "bla :-)" and you will see it will return an error. How can I solve this?
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Can you post example please ?
Template where I can see this problem, and url and field where this happens
 

MisterP

Пользователь
Регистрация
08.02.2014
Сообщения
87
Благодарностей
0
Баллы
6
OK. I want my bot to check for the presence of "whats up ;-)", which is in the third line of this site

https://nopaste.me/view/17fb6bc4

I just right click on the line, then "check presence of text". But it doens't work because the text that I am looking for has ";-)" in it. The ")" makes an error!
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Use this code. If text will be there it will go out to green dot, if not then red.

C#:
if(instance.ActiveTab.PageText.Contains("whats up ;)")) return true;
else return null;
Cheers
 
  • Спасибо
Реакции: britalic

MisterP

Пользователь
Регистрация
08.02.2014
Сообщения
87
Благодарностей
0
Баллы
6
Use this code. If text will be there it will go out to green dot, if not then red.

C#:
if(instance.ActiveTab.PageText.Contains("whats up ;)")) return true;
else return null;
Cheers
Thank you very much!
Now the last part that I need to do is this: How can I assign a variable to the instance.ActiveTab.PageText.Contains("...") part? I want there to be a variable that I have specified..

Something like this instance.ActiveTab.PageText.Contains({-Variable.Text-}) but obviously this doesn't work with c#, so how can I transform a ZennoPoster varaible to c# and enter it in that aforementioned code???

Thanks again, really helpful Moderator :-)
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Thank you very much!
Now the last part that I need to do is this: How can I assign a variable to the instance.ActiveTab.PageText.Contains("...") part? I want there to be a variable that I have specified..

Something like this instance.ActiveTab.PageText.Contains({-Variable.Text-}) but obviously this doesn't work with c#, so how can I transform a ZennoPoster varaible to c# and enter it in that aforementioned code???

Thanks again, really helpful Moderator :-)
Then this code will help you:

C#:
if(instance.ActiveTab.PageText.Contains(project.Variables["projectVariableName"].Value)) return true;
else return null;
in projectVariableName enter any name your project variable have and it should work.
 

MisterP

Пользователь
Регистрация
08.02.2014
Сообщения
87
Благодарностей
0
Баллы
6
Thank you very much, will try it right now as we speak :-)

Just another question: is there any tutorial or something where I can learn the internal ZennoPoster architecture to integrate into c#? I for instance didn't know how to engage the instance and get the pagetext. Also I didn't know that I can access viarables thru project.variables[".."].value

Where can I read about ZennoPoster c# so I won't bother you guys again :D
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113
Thank you very much, will try it right now as we speak :-)

Just another question: is there any tutorial or something where I can learn the internal ZennoPoster architecture to integrate into c#? I for instance didn't know how to engage the instance and get the pagetext. Also I didn't know that I can access viarables thru project.variables[".."].value

Where can I read about ZennoPoster c# so I won't bother you guys again :D
ZennoPoster assembly is there https://help.zennolab.com/en/v5/zennoposter/5.9.9/webframe.html#topic1.html
 
  • Спасибо
Реакции: britalic

Tobbe

Client
Регистрация
01.08.2013
Сообщения
428
Благодарностей
148
Баллы
43
  • Спасибо
Реакции: britalic

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