How to press keys in iMacros 10?

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

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
groundfalling
Posts: 46
Joined: Tue Jul 01, 2014 1:26 pm

How to press keys in iMacros 10?

Post by groundfalling » Fri Sep 14, 2018 9:26 am

iMacros 10.0.2.1450 Free
Firefox 61.0.1
Ubuntu 16.0.4

Hi,
I used to use 'EVENT' to load the homepage

Code: Select all

EVENT TYPE=KEYPRESS KEY=36 MODIFIERS=alt
but EVENT is no longer supported in iMacros 10 and neither is

Code: Select all

URL GOTO=about:home
working. Does anyone know any other way to load the homepage through iMacros 10? Thank you
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to press keys in iMacros 10?

Post by chivracq » Sat Sep 15, 2018 12:08 am

groundfalling wrote:

Code: Select all

iMacros 10.0.2.1450 Free
Firefox 61.0.1
Ubuntu 16.0.4 
Hi,
I used to use 'EVENT' to load the homepage

Code: Select all

EVENT TYPE=KEYPRESS KEY=36 MODIFIERS=alt
but EVENT is no longer supported in iMacros 10 and neither is

Code: Select all

URL GOTO=about:home
working. Does anyone know any other way to load the homepage through iMacros 10? Thank you
'KEY=36' is the 'Home' Key I reckon...(?)

Yep about 'URL GOTO=about:home', I had reported it during the Beta-Testing Phase...

But I guess for a Workaround, you'll have to "go back to the Basics", and re-implement yourself all 'KEYPRESS' Functionality/Commands from Scratch from pure JS... :shock:
Have a look already at the following Thread (from before the 'EVENT' Mode was implemented, for a Workaround for 'EVENT'/'DS' Mouse Moves, similar (JS) Syntax/Commands for Keypress Functionality I would think...):
- Workaround for lack of DS mouse commands

I'm not even sure it will be "possible", that was actually my "biggest surprise" when v10.0.2 Beta was offered for Beta-Testing, that the 'EVENT' Mode was not supported/implemented anymore, while v10.0.2 was supposed to be based on v10.0.1/.2 for CR for which the 'EVENT' Mode is implemented... I don't know, maybe some Technical Limitation for FF57/60/62, I never saw any Statement/Explanation from TechSup/Dev about that, but it now sounds very "strange" to realize that all Versions of iMacros now support the 'EVENT' Mode except on FF while for 3 or 4 years, the 'EVENT' Mode was only supported on FF, ah-ah...!
(+ a bit the same with '.js' Scripts...)

And of course for your OP, you can always hard-code your Homepage with 'URL GOTO' in your Script... :oops:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to press keys in iMacros 10?

Post by chivracq » Sat Sep 15, 2018 7:17 pm

Oh...!, and here you had another Thread/'How-to' around the same time from the same Advanced User about Keypress:
- How to simulate a keypress using Javascript
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
groundfalling
Posts: 46
Joined: Tue Jul 01, 2014 1:26 pm

Re: How to press keys in iMacros 10?

Post by groundfalling » Sat Sep 22, 2018 9:24 am

@chivracq
Could you please kindly suggest how can i press "Alt" plus Key'36' in imacros 10

Code: Select all

EVENT TYPE=KEYPRESS KEY=36 MODIFIERS=alt
using this:

Code: Select all

URL GOTO=javascript:=var<SP>evt=document.createEvent("KeyboardEvent");evt.initKeyEvent("keypress",true,true,window,0,0,0,0,13,13);body.dispatchEvent(evt);
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: How to press keys in iMacros 10?

Post by chivracq » Sat Sep 22, 2018 2:35 pm

groundfalling wrote:@chivracq
Could you please kindly suggest how can i press "Alt" plus Key'36' in imacros 10

Code: Select all

EVENT TYPE=KEYPRESS KEY=36 MODIFIERS=alt
using this:

Code: Select all

URL GOTO=javascript:=var<SP>evt=document.createEvent("KeyboardEvent");evt.initKeyEvent("keypress",true,true,window,0,0,0,0,13,13);body.dispatchEvent(evt);
Hum, Key=36 is the 'Home' Key I reckon, for 'Alt^Home' to open the Browser Homepage...

But, pfff..., I don't know, I've never "played" with that JavaScript Event Functionality, I only use some very basic JS Functionality on Arrays/Strings/Numbers in 'EVAL()' for myself, you are already way more Advanced than me, ah-ah...!

But hum, from a quick look, from this Thread on SOF (2nd Answer), I would go "playing" with stg like...:

Code: Select all

URL GOTO=javascript:=document.dispatchEvent(new<SP>KeyboardEvent("keydown",{"key":36,altKey:true}));
I already tried several "Combinations"..., It doesn't work for me (tried on v8.8.2 (+PM 26.3.3) + v8.9.7 (+FF55)), maybe for you on v10.0.2, or you'll find the "correct" Syntax... :wink:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
groundfalling
Posts: 46
Joined: Tue Jul 01, 2014 1:26 pm

Re: How to press keys in iMacros 10?

Post by groundfalling » Wed Sep 26, 2018 7:58 am

tried this:

Code: Select all

macroCode += 'URL GOTO=javascript:document.dispatchEvent(new<SP>KeyboardEvent("keydown",{"key":36,altKey:true}));\n';
doesn't work.
Post Reply