Press ENTER in EVENT mode

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
ni_soros
Posts: 4
Joined: Mon Jul 21, 2014 7:05 pm

Press ENTER in EVENT mode

Post by ni_soros » Tue Aug 05, 2014 9:12 pm

I am recording entering tasks into a list on Wunderlist. Here is the code that I have come up with:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
EVENT TYPE=MOUSEDOWN SELECTOR="#tasks>DIV>DIV>INPUT" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#tasks>DIV>DIV>INPUT" CHARS="asdf"
EVENT TYPE=KEYPRESS SELECTOR="#tasks>DIV>DIV>INPUT" KEY=13
As you can see by the "KEY=13" bit on the last line (aka the ENTER key), it has recorded the ENTER keystroke. However, when I play the macro, it doesn't work. It will only enter "asdf" into the text field and stop there.
chivracq
Posts: 8874
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Press ENTER in EVENT mode

Post by chivracq » Tue Aug 05, 2014 9:54 pm

ni_soros wrote:I am recording entering tasks into a list on Wunderlist. Here is the code that I have come up with:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
EVENT TYPE=MOUSEDOWN SELECTOR="#tasks>DIV>DIV>INPUT" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#tasks>DIV>DIV>INPUT" CHARS="asdf"
EVENT TYPE=KEYPRESS SELECTOR="#tasks>DIV>DIV>INPUT" KEY=13
As you can see by the "KEY=13" bit on the last line (aka the ENTER key), it has recorded the ENTER keystroke. However, when I play the macro, it doesn't work. It will only enter "asdf" into the text field and stop there.
I could reproduce indeed... Easy Workaround is to press the 'Left Arrow' (=37) just before hitting the 'Enter' Key:

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
EVENT TYPE=MOUSEDOWN SELECTOR="#tasks>DIV>DIV>INPUT" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#tasks>DIV>DIV>INPUT" CHARS="asdf"
'EVENT TYPE=KEYPRESS SELECTOR="#tasks>DIV>DIV>INPUT" KEY=13
EVENTS TYPE=KEYPRESS SELECTOR="#tasks>DIV>DIV>INPUT" KEYS="[37,13]"
Tested on iMacros v8.8.2 for FF, Pale Moon v24.7.0 (=FF31), WinXP SP3.
- (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...
ni_soros
Posts: 4
Joined: Mon Jul 21, 2014 7:05 pm

Re: Press ENTER in EVENT mode

Post by ni_soros » Sun Aug 10, 2014 2:58 pm

Excellent! Works perfectly. Thank you very much.

Did you figure this out just by messing around with it, or is there a method to the madness?
chivracq
Posts: 8874
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Press ENTER in EVENT mode

Post by chivracq » Sun Aug 10, 2014 4:02 pm

ni_soros wrote:Excellent! Works perfectly. Thank you very much.

Did you figure this out just by messing around with it, or is there a method to the madness?
Yes and Yes...! The Method is to creatively mess around with iMacros, that's how I got all my knowledge of iMacros... :oops:

Other inspiring Reading for you if you want to acquire some more insight in the EVENT Mode:
- Re: Feedback and Issues on EVENT Recording Mode.

Think of adding "[Solved]" to your Thread Title, that makes it easier to find for other Users...
- (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...
ni_soros
Posts: 4
Joined: Mon Jul 21, 2014 7:05 pm

Re: Press ENTER in EVENT mode

Post by ni_soros » Sun Aug 10, 2014 5:13 pm

Very good. thanks for the tips.

While this is working for the script I just posted above, I wrote another one, for adding someone to a list on Wunderlist. It was working about 50% of the time.

Code: Select all

VERSION BUILD=8820413 RECORDER=FX
EVENT TYPE=CLICK SELECTOR="#tasks>DIV:nth-of-type(2)>DIV:nth-of-type(2)>DIV>A" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#modals>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>INPUT" CHARS="youremail@gmail.com"
EVENTS TYPE=KEYPRESS SELECTOR="#modals>DIV>DIV>DIV>DIV>DIV:nth-of-type(3)>DIV>DIV>INPUT" KEYS="[37,13]"
I wonder if it is simply a question of the time in between typing the last letter and pressing ENTER. Maybe the Left Arrow does the same thing as a half-second delay. I would like to test this soon, when I've got another bit of free time. :)
techimac
Posts: 298
Joined: Fri Feb 20, 2015 9:27 pm

Re: Press ENTER in EVENT mode

Post by techimac » Sat Apr 16, 2016 10:57 am

How to press Down Arrow or Page Down key?
User avatar
thecoder2012
Posts: 380
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Press ENTER in EVENT mode

Post by thecoder2012 » Sat Apr 16, 2016 8:33 pm

Other way to press your ENTER key with javascript:

Code: Select all

var div = window.document.getElementById('yourid');
div.focus();

var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
utils.sendKeyEvent('keypress', window.KeyEvent["DOM_VK_RETURN"], 0, 0, 0);
Tested with iMacros 8.9.7, Win8.1 and Waterfox 55
techimac wrote:How to press Down Arrow or Page Down key?
' Page Down '
EVENT TYPE=KEYPRESS SELECTOR=* KEY=34

And in a row:
' Page Down '
EVENTS TYPE=KEYPRESS SELECTOR=* KEYS="[34,34,34,34,34,34,34,34,34,34,34]"

And with arrow keys:
' Down (arrow)
EVENT TYPE=KEYPRESS SELECTOR=* KEY=40

' Down (arrow)
EVENTS TYPE=KEYPRESS SELECTOR=* KEYS="[40,40,40,40,40,40,40]"

See http://forum.imacros.net/viewtopic.php? ... 857#p68857
Last edited by thecoder2012 on Fri May 04, 2018 6:56 am, edited 1 time in total.
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
techimac
Posts: 298
Joined: Fri Feb 20, 2015 9:27 pm

Re: Press ENTER in EVENT mode

Post by techimac » Sat Apr 16, 2016 8:38 pm

I tried same in twitter but didn't worked.
User avatar
thecoder2012
Posts: 380
Joined: Sat Aug 15, 2015 5:14 pm
Location: Internet
Contact:

Re: Press ENTER in EVENT mode

Post by thecoder2012 » Sat Apr 16, 2016 8:55 pm

techimac wrote:I tried same in twitter but didn't worked.
Please use this thread for twitter: http://forum.imacros.net/viewtopic.php? ... 861#p68861
Join 9kw.eu Captcha Service now and let your iMacros continue downloads and scripts while you sleep. - Custom iMacros? Contact me! :idea:
Webert
Posts: 6
Joined: Wed Dec 04, 2019 1:33 pm

Re: Press ENTER in EVENT mode

Post by Webert » Wed Dec 04, 2019 5:32 pm

thecoder2012 wrote:
Sat Apr 16, 2016 8:55 pm
techimac wrote:I tried same in twitter but didn't worked.
Please use this thread for twitter: http://forum.imacros.net/viewtopic.php? ... 861#p68861

132/5000
Good afternoon.

Your code makes the page scroll down only on the home screen. How do I scroll the page down in likes?

Example: https://ibb.co/pzW8hj4
Post Reply