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?
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.
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...
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
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.
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");
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();
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..