How to delay Keystroke transmission?

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
BGood
Posts: 19
Joined: Thu Mar 31, 2011 2:23 am

How to delay Keystroke transmission?

Post by BGood » Thu Jan 16, 2014 4:20 am

Is there a way to introduce a delay between transmitted keystrokes (not between statements as in REPLAY SPEED)? I am having a problem with a particular website which senses keystroke transmission speed. The browser is IE9 and the iMacros script was written in iMacros 7. Thanks!
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to delay Keystroke transmission?

Post by chivracq » Thu Jan 16, 2014 10:33 am

My 2 cts:
If you were using Firefox, you could try using the EVENT Mode and split the 'TYPE=KEYPRESS' Events Keystroke by Keystroke, adding eventually some mini-Wait Statements in-between or eventually some useless "heavy" "EVAL" or "URL GOTO=javascript:" Computing Statements instead..., or select/extract some useless Element on the Page just to loose a bit of time...

Using IE, you don't have EVENT Mode, but I would then try, lets say if you need to fill in some Input Field with let's say "mylogin", I would try to split it into several Statements by filling in the same Field several times with "m", then "my", then "myl", then "mylo", then "mylog", then "mylogi" and then "mylogin" and then you can add some extra Statement between them...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
BGood
Posts: 19
Joined: Thu Mar 31, 2011 2:23 am

Re: How to delay Keystroke transmission?

Post by BGood » Thu Jan 16, 2014 3:12 pm

Thanks for the suggestion, chivracq. I remember vaguely that there was some provision to execute javascript in iMacros scripting, but I can't seem to find it now. Would that be another approach? Thanks.
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to delay Keystroke transmission?

Post by chivracq » Thu Jan 16, 2014 7:17 pm

BGood wrote: I remember vaguely that there was some provision to execute javascript in iMacros scripting, but I can't seem to find it now.
Euh..., you don't need to remember anything, I already mentioned the 2 ways to execute some Javascript in an .iim Macro in my previous msg...:
"EVAL" and "URL GOTO=javascript:"
But that's just an idea to "occupy" the iMacros Runtime Engine and delay the Keystrokes...
You could use some fake Elements Tagging/Extracting on the Page as well... Or you can open a 2nd TAB and switch to and back from it...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
BGood
Posts: 19
Joined: Thu Mar 31, 2011 2:23 am

Re: How to delay Keystroke transmission?

Post by BGood » Thu Jan 16, 2014 8:37 pm

Got it, thanks. I'm awake now.
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to delay Keystroke transmission?

Post by chivracq » Fri Jan 17, 2014 12:47 pm

Hope you'll come back and post the Solution you will have retained in the end as I begin to see more and more Sites with Keystrokes (Speed) Checking and your Solution might come in handy for other Users...

Good luck in the meantime...!
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
BGood
Posts: 19
Joined: Thu Mar 31, 2011 2:23 am

Re: How to delay Keystroke transmission?

Post by BGood » Fri Jan 17, 2014 3:41 pm

chivracq,

I've been thinking about it a little, but js is not my native language. I haven't tested yet, or put it into the iMacros javascript: packaging with all the <sp> conversions, but what I have come up with is as follows:

Code: Select all

//function pace introduces 250ms char by char delay in entry of USERNAME
 setTimeout(pace("USERNAME"),250);
 function pace(s)
 {
	for(var i=0;i<s.length; i++)
	{
		var evt=document.createEvent("KeyboardEvent");
		evt.initKeyEvent (“keypress”, true, true, window, false, false, false, false, 0, s.charCodeAt (i));
		event_object.dispatchEvent (evt);
	}
 }
One of the iMacros postings on the subject also suggests that the event dispatch needs to be of the form:

Code: Select all

document.getElementById("USERNAMETEXTBOX").dispatchEvent(evt);
If you are a js afficianado, do you think this is the correct approach? I'll test it out when I have some more time.

Thanks!
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to delay Keystroke transmission?

Post by chivracq » Mon Jan 20, 2014 12:47 am

Well, I'm definitely not a Javascript Guru, though I might have earned my first 20$ tonight thanks to Javascript:
http://forum.imacros.net/viewtopic.php?f=2&t=22333#p56363

... But from your last Post, I can tell that you go for the Nobel Price...!

My idea with Javascript was just to occupy the iMacros Runtime Engine for half a second between each Keystroke with some fake Navigation/Extraction/Javascript_Calculation...

Good idea for an Add-on, I would think...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
BGood
Posts: 19
Joined: Thu Mar 31, 2011 2:23 am

Re: How to delay Keystroke transmission?

Post by BGood » Mon Jan 20, 2014 3:16 pm

I had no idea that being a lurker in the iOpus forums could be so lucrative. Definitely go for the Paypal account.
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to delay Keystroke transmission?

Post by chivracq » Mon Jan 20, 2014 3:31 pm

BGood wrote:I had no idea that being a lurker in the iOpus forums could be so lucrative. Definitely go for the Paypal account.
And I learned a new word...:
Lurker - Wikipedia, the free encyclopedia
en.wikipedia.org/wiki/Lurker‎
In Internet culture, a lurker is typically a member of an online community who observes, but does not actively participate. The exact definition depends on context.
Hum..., I do participate on the Forum though...!
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
BGood
Posts: 19
Joined: Thu Mar 31, 2011 2:23 am

Re: How to delay Keystroke transmission?

Post by BGood » Mon Jan 20, 2014 3:41 pm

Sorry, my comment was not intended to be disparaging in any way. I should have said "key community activist and evangelist". :D
chivracq
Posts: 8781
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to delay Keystroke transmission?

Post by chivracq » Mon Jan 20, 2014 4:33 pm

BGood wrote:Sorry, my comment was not intended to be disparaging in any way. I should have said "key community activist and evangelist". :D
No need to be sorry, I took your Comment at a "positively slightly ironic with some touch of envy fun-level", but "iMacros activist and evangelist" does suit me better indeed, I would like to think...

I quite like your sense of humor btw...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply