how do I perform a paste function

neutralhatter

Client
Регистрация
17.08.2012
Сообщения
100
Благодарностей
6
Баллы
18
I just want to paste a value... not by searching for a regex... just paste where I am right now...
apparently there are some networks that just automatically change their html code when an account is suspicious... pretty crazy right?

thanks in advance
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
If you mean pasting values to text fields you can do it only if you know attributes of these fields. Or if you trained Intellisearch for these fields.
 

neutralhatter

Client
Регистрация
17.08.2012
Сообщения
100
Благодарностей
6
Баллы
18
Too bad... I want to work with tab and then paste... works better
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
You can use keystrokes emulation and put data like {TAB}hello{TAB}another blabla{TAB}
 
  • Спасибо
Реакции: neutralhatter

neutralhatter

Client
Регистрация
17.08.2012
Сообщения
100
Благодарностей
6
Баллы
18
That's what I'm looking for. thanks,
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
Anyway I don't see the answer )
When do you use CTRL?
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 812
Благодарностей
1 187
Баллы
113

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113

hotohori

Client
Регистрация
10.02.2012
Сообщения
154
Благодарностей
40
Баллы
28
What lokiys is trying to say is that, we don't really use {PGDN} for typing either but it exist in keystroke emulation, so why can't we have {CTRL} too?

I guess the answer is, {ctrl} on it's own does not do anything.

I agree with lokiys that it will be good if we can perform simple functions using keystroke like {ctrl}+{a} or {crtl}+{c} or {ctrl}+{v}.

Sometimes I might want to type something in a textbox or field which already have some text in it. If we have the {ctrl}+{a}, I can simply use it to select all and replace with my text.
 
  • Спасибо
Реакции: robertign0 и KitKat21

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
{PGDN} exist for scrolling the page which is necessary for some tasks.

Zennoposter has it's own functions for replacing text that is already in a field.
It's Set - value.

All necessary keys are already presented in keystrokes emulation action.
 
  • Спасибо
Реакции: KitKat21

hotohori

Client
Регистрация
10.02.2012
Сообщения
154
Благодарностей
40
Баллы
28

neutralhatter

Client
Регистрация
17.08.2012
Сообщения
100
Благодарностей
6
Баллы
18
to come back to the solution provided.... I can't use this solution.... the text is around 10000 caracters.... it takes ages !

Please add a function to Set value at current position......

Or do you have any other workaround?
 

neutralhatter

Client
Регистрация
17.08.2012
Сообщения
100
Благодарностей
6
Баллы
18
It's been over 10 minutes and it's still typing... If I'm correct the typing will last for around 30 to 40 minutes.... I'm gonna interrupt and think about a different solution...

Suggestions are welcome !


Edit: It didn't take 30 minutes... but 15 minutes is way too long for a paste function anyways...
 

hotohori

Client
Регистрация
10.02.2012
Сообщения
154
Благодарностей
40
Баллы
28
Hi neutralhatter,

Are you not able to find the field by regex?
Then how did you get to "current position"?
 

neutralhatter

Client
Регистрация
17.08.2012
Сообщения
100
Благодарностей
6
Баллы
18
hey hotohori,

No, read the original post please... I'm still stuck on this...
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 715
Баллы
113
It's not a paste function. It's keystrokes emulation.
I you need to use set - value, you need to know HTML attributes of the field.
 

neutralhatter

Client
Регистрация
17.08.2012
Сообщения
100
Благодарностей
6
Баллы
18
I understand that....that's the entire issue... the html changes on some accounts
 

KitKat21

Client
Регистрация
02.05.2017
Сообщения
263
Благодарностей
191
Баллы
43

robertign0

Пользователь
Регистрация
20.01.2022
Сообщения
33
Благодарностей
6
Баллы
8
i know it has been years since this topic was active, but currently facing same problem.
i need to enter text, and with keyboard simulation it takes a lot of time, works, but the delay is huge
ctrl down + V would do the work, just trying to figure out where to do the CTRL down + C (it is always the same position and same text)... ideas are welcome
 
  • Спасибо
Реакции: Pierre Paul Jacques

KitKat21

Client
Регистрация
02.05.2017
Сообщения
263
Благодарностей
191
Баллы
43
i know it has been years since this topic was active, but currently facing same problem.
i need to enter text, and with keyboard simulation it takes a lot of time, works, but the delay is huge
ctrl down + V would do the work, just trying to figure out where to do the CTRL down + C (it is always the same position and same text)... ideas are welcome
This works for me:
instance.ActiveTab.KeyEvent("c","press","ctrl");
string CopiedText = System.Windows.Forms.Clipboard.GetText();

Place it in a C# block.


Before copying text, first you need to select the text you want to copy. There are different ways to do that, for instance using Regex to extract it from a page or left-mouse clicking on the page and then doing CTRL + A to copy everything from a certain tab/page.



Someone here a while back ago shared these great tips (can't remember the thread).

For example, I use copy-paste text a lot for sending out emails to prospects.
93428


First, I created a simple Word doc with my email text (you can include bolding, italic, links etc.), then saved it out as a 'webpage' .html. (Select it from the dropdown when saving out the word doc.
Then I upload this to Amazon S3 and make it public. I copy the link to the file and put it into my bot.

The bot logs in to my webmail, then when it's time to get the text for the email, it opens another tab, goes to that page on S3 with the email text. Then left-mouse clicks on the page. Then does CTRL + A. Then copies all the text.
Tab tab = instance.ActiveTab;

tab.Navigate(project.Variables["HTMLemailPageURL"].Value);
if (tab.IsBusy) tab.WaitDownloading();
Thread.Sleep(3000);

// Click on page
HtmlElement he = instance.ActiveTab.GetDocumentByAddress("0").FindElementByAttribute("span", "class", "c0", "regexp", 0);
if (he.IsVoid) return -1;

tab.FullEmulationMouseClick("left", "click");

//copy text
instance.ActiveTab.KeyEvent("a","press","ctrl");
instance.ActiveTab.KeyEvent("c","press","ctrl");

string CopiedText = System.Windows.Forms.Clipboard.GetText();
project.SendInfoToLog("Copied text: " + CopiedText, true);

if(CopiedText.Length<60)
{
project.SendErrorToLog("copied text is shorter than 60 length! Didn't copy?", true);
return null;
}
else project.SendInfoToLog("copied text successfully I think", true);

Then paste it from the clipboard into the email field (or wherever).

instance.ActiveTab.KeyEvent("v","press","ctrl");


Here's code I use to paste plain text that I got from a text file and set to a variable:

lock(SyncObjects.InputSyncer)
{
var text = project.Variables["EmailBodyText"].Value;

// gets text from clipboard
String previous_text = null;
previous_text = System.Windows.Forms.Clipboard.GetText();

// CTRL+V
System.Windows.Forms.Clipboard.SetText(text);
instance.ActiveTab.KeyEvent("v","press","ctrl");

// returns clipboard to previous state
System.Windows.Forms.Clipboard.Clear();
System.Windows.Forms.Clipboard.SetText(previous_text);
}
All this code was shared by someone on the forum once.
 

robertign0

Пользователь
Регистрация
20.01.2022
Сообщения
33
Благодарностей
6
Баллы
8
thanks a lot for taking time for providing the detailed answer, it is really appreciated. already optimized a bit, but will definetely try this approach as well..
 
  • Спасибо
Реакции: Pierre Paul Jacques

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