Do keypress without EVENT mode?

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
Legalien
Posts: 100
Joined: Mon Feb 15, 2016 6:47 pm
Contact:

Do keypress without EVENT mode?

Post by Legalien » Fri Nov 22, 2019 1:23 pm

Firefox 55.0.2
iMacros 8.9.7
Windows 10

Is there a way to do keypress command without using the EVENT mode?

Recently I needed to do keypress and after looking it up online I found something that works:

EVENT TYPE=KEYPRESS CHAR="r" MODIFIERS="ctrl+shift"

But unfortunately too often the script just gets stuck on that command, looping it over and over and over again (yes I have ERRORIGNORE in my script but it still happens).

So is there a way to do keypress with regular recording mode, or any other way?

Thanks
Buy Social Media Services - https://Socialesale.com
chivracq
Posts: 9311
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Do keypress without EVENT mode?

Post by chivracq » Fri Nov 22, 2019 4:25 pm

Legalien wrote:
Fri Nov 22, 2019 1:23 pm

Code: Select all

Firefox 55.0.2
iMacros 8.9.7
Windows 10
Is there a way to do keypress command without using the EVENT mode?

Recently I needed to do keypress and after looking it up online I found something that works:

Code: Select all

EVENT TYPE=KEYPRESS CHAR="r" MODIFIERS="ctrl+shift"
But unfortunately too often the script just gets stuck on that command, looping it over and over and over again (yes I have ERRORIGNORE in my script but it still happens).

So is there a way to do keypress with regular recording mode, or any other way?

Thanks

Hum..., I was going to "bash" you about selecting the "correct" Sub-Forum when opening a Thread, and that this one probably has nothing specific to FF, but 'Ctrl^Shift^R' is actually specific to the Software it is used in (=> FF in your Case), even if it also behaves the same in CR, but it is not supported in IE and probably also not in iMB, so yep..., the 'FF' Sub-Forum is "the" correct one then... :wink:
(But you could have explained that part yourself...)

Just like you could mention/explain what 'Ctrl^Shift^R' is supposed/meant to do...!? If you had to "look it up online" yourself, that means not "everybody" knows what this Shortcut is supposed to do...! Well, I don't... :?

But, OK, according to this neat/useful Site:
Ctrl + Shift + R

Browsers:
- Firefox Quantum - Reload (override cache)
- Google Chrome - Reload the current page, ignoring cached content
- Microsoft Edge - Enter reading view
- Opera - Reload selected frame
- IE - (Not listed)

Web applications:
- Chromebook and Chrome OS - Reload your current page without using cached content
- Gmail - Align right
- Yahoo Mail - Align Right
So, hum OK..., on FF, that's the same like a 'Ctrl^F5' then, that I already knew... 8)

One "Precision", as you didn't post any Script, but if you are trying to use this Shortcut in FF on a 'Gmail' ('Standard' I reckon) Page, using the 'EVENT' Mode, the 'Align Right' Func from 'Gmail' won't be triggered, but the 'Hard Refresh' which is defined at the Browser Level will...

>>>

=> OK, my 2cts "Ideas" to (try to) answer your Qt..., even if pfff... :? , you don't give much-much "Background" Info about what (and why) you want to do, I don't really understand your "too often the script just gets stuck on that command, looping it over and over and over again", then tja..., but OK, here we go...: 8)

1- You can try the 'F5' or 'Ctrl^F5' with the 'EVENT' Mode also... :idea:

2- From the 'TAG' Mode, nope, you can't fire Keypress Events, only typing some Content in some Input Field using the 'CONTENT' Param, but that's "not relevant" for a 'Hard Refresh' of the Page...

3- Well, you do have the iMacros 'REFRESH' Command, but it's not a "Hard" Refresh, it won't bypass the Browser Cache..., well, I think..., I never did any "deep" Testing about it as I don't "really" use that Command, I prefer a "Reload" of a Page with 'URL GOTO' that I find more "reliable"...

4- But maybe combined with a 'CLEAR' just before the 'REFRESH' (or 'URL GOTO'), that would clear the Cache and would achieve the same Result like a Hard Refresh..., but will also clear all your Browser History and Cookies etc on that FF-Profile... That could be your Workaround... :idea:

5- The 'DS' Mode in iMB/IE also supports some Keypress Actions, but the "List" is very limited (to 'ENTER' / 'TAB' etc...)...

6- If you search the Forum, Advanced User @'David Poor' (I think), had posted "once", before the 'EVENT' Mode got implemented in FF in v8.24 for FF, so the Thread is probably 8 or 10 years old, a Method to fire Mouse and Keyboard Event from JS, either from a '.js' Script, or that Syntax would also probably work from the 'URL GOTO=javascript' Syntax... :idea:
Well..., "would also", hum..., the Thread is pretty old, and probably applied then to FF v4/6/10/14 Max, so there is no "Guarantee" that it will still work, ah-ah...! :oops:

7- And last "Idea", from the 'about:cache' Config Page, you can also access 3 Pages to clear the Memory/Disk/Offline Caches... :idea:
- (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...
Legalien
Posts: 100
Joined: Mon Feb 15, 2016 6:47 pm
Contact:

Re: Do keypress without EVENT mode?

Post by Legalien » Fri Nov 22, 2019 9:56 pm

I am always correct in my sub-forum selections 8) :D

The ctrl+alt+r in Firefox basically refreshes the page. But it's something like a super refresh, if I may call it like that. Yes, like ctrl+f5 exactly.

I didn't post a script because for my problem really the only command required is the line of code I shared in my original post. The problem I have is with Pinterest. But I have no idea how you could replicate it. Thought you may figure out why this happens and how I can solve it.

When I visit Pinterest I get a blank page. I tried clearing Firefox cache and then opening the site, same problem. I tried refreshing the page by clicking the Firefox refresh icon many many times, always loads a blank page. I tried the REFRESH command in iMacros, the same problem. I also tried disabling cookies for Pinterest, but then Pinterest won't open and it shows a notification that you must have cookies enabled in order to use the site.

But if I visit Pinterest and get the blank page, and then press ctrl+f5 or ctrl+alt+r on my keyboard, on the reload the page loads just fine :)

And so I found that command which allows me to do the keypress with iMacros, and the script goes something like this:

visit pinterest
event keypress ctrl+shift+r in order to actually load page
continue other actions

And this is not the best solution, as I would love to force Firefox to always load Pinterest with ctrl+f5 or ctrl+alt+r on FIRST/EVERY load, but I can't figure out how to do that.

But even the keypress won't work because often the script will freeze on the "event keypress" command, and just get stuck there and keep looping over and over and over forever, never displaying an error and stopping, never crashing, and never continuing. Just an endless loop :(

And that's why I came here to see if there's maybe a different way (other than EVENT) to stimulate keypress with iMacros, or if perhaps you can see a different way of solving my problem that I haven't considered.

---

1. Actually just pressing F5 doesn't work. The page is still blank after the reload. Only ctrl+f5 and ctrl+shift+r actually works. I have no idea how it's different. So no keypresses other than EVENT mode?

2. How about... like... if I install some Firefox extension that puts like a virtual keyboard on the screen and then I use regular recording mode to click the keys on that virtual keyboard? Seriously, could that work?

3. The REFRESH command doesn't do it in this case. I tried it multiple times, and it doesn't do it.

4. I can't have cookies cleared, it will log me out of other sites. I can't do that.

5. Hm, no.

6. So what are you saying? I could have my .iim script jump to a .js script just to execute the hard refresh, and then jump back to the .iim script and continue? Is that what you're saying? This may actually work, and the .js script may get it done without ever freezing. But did I understand you correctly?

7. Clearing cache doesn't work, I tried it. I don't want to clear cookies.
Buy Social Media Services - https://Socialesale.com
chivracq
Posts: 9311
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Do keypress without EVENT mode?

Post by chivracq » Sat Nov 23, 2019 6:32 pm

Legalien wrote:
Fri Nov 22, 2019 9:56 pm
I am always correct in my sub-forum selections 8) :D

The ctrl+alt+r in Firefox basically refreshes the page. But it's something like a super refresh, if I may call it like that. Yes, like ctrl+f5 exactly.

I didn't post a script because for my problem really the only command required is the line of code I shared in my original post. The problem I have is with Pinterest. But I have no idea how you could replicate it. Thought you may figure out why this happens and how I can solve it.

When I visit Pinterest I get a blank page. I tried clearing Firefox cache and then opening the site, same problem. I tried refreshing the page by clicking the Firefox refresh icon many many times, always loads a blank page. I tried the REFRESH command in iMacros, the same problem. I also tried disabling cookies for Pinterest, but then Pinterest won't open and it shows a notification that you must have cookies enabled in order to use the site.

But if I visit Pinterest and get the blank page, and then press ctrl+f5 or ctrl+alt+r on my keyboard, on the reload the page loads just fine :)

And so I found that command which allows me to do the keypress with iMacros, and the script goes something like this:

visit pinterest
event keypress ctrl+shift+r in order to actually load page
continue other actions

And this is not the best solution, as I would love to force Firefox to always load Pinterest with ctrl+f5 or ctrl+alt+r on FIRST/EVERY load, but I can't figure out how to do that.

But even the keypress won't work because often the script will freeze on the "event keypress" command, and just get stuck there and keep looping over and over and over forever, never displaying an error and stopping, never crashing, and never continuing. Just an endless loop :(

And that's why I came here to see if there's maybe a different way (other than EVENT) to stimulate keypress with iMacros, or if perhaps you can see a different way of solving my problem that I haven't considered.

---

1. Actually just pressing F5 doesn't work. The page is still blank after the reload. Only ctrl+f5 and ctrl+shift+r actually works. I have no idea how it's different. So no keypresses other than EVENT mode?

2. How about... like... if I install some Firefox extension that puts like a virtual keyboard on the screen and then I use regular recording mode to click the keys on that virtual keyboard? Seriously, could that work?

3. The REFRESH command doesn't do it in this case. I tried it multiple times, and it doesn't do it.

4. I can't have cookies cleared, it will log me out of other sites. I can't do that.

5. Hm, no.

6. So what are you saying? I could have my .iim script jump to a .js script just to execute the hard refresh, and then jump back to the .iim script and continue? Is that what you're saying? This may actually work, and the .js script may get it done without ever freezing. But did I understand you correctly?

7. Clearing cache doesn't work, I tried it. I don't want to clear cookies.

"I am always correct in my sub-forum selections 8) :D "
=> Yeah-yeah, hein-hein-hein...!, "Lache nur Bauer...!", I hesitated quite a bit and only came "to my Conclusion" based on Info that you "should" have provided, but didn't of course, so "don't push your Luck", grrr...!, ah-ah...! :wink:

Hum, OK, I completely understand the 'Hard Refresh' about this 'Pinterest' Site...
But hum, I also know this "Blank Page" from quite several Sites I use or sometimes check, and I also sometimes get that Blank/White Page, while I can see some Content in the Source, but only in my Default Browser => PM v26.3.3, but as soon as I open the same URL in FF v55.0.3, then it "works" just fine... But I never tried a 'Hard Refresh' in PM26... Hum, won't "really" help I'm afraid, as I usually get the White/Blank Page directly upon the first Visit...
But hum, I'll check from now on with 'Ctrl^F5', just in case, if I can find a Site that "reacts" to that, ... and can do some "Testing"...

I don't have any Account on 'Pinterest'..., I know the Name of the Site, what is it for...?
(I have no Idea honestly, "pinterest" sounds like "p" + interest" to me, thus "Interest in "p"", yeah, what is "p" for then...!?, ah-ah...!", => "People"...?/"Pasta"...?/"Purple Life"...?/"Photo"...?, hum, not the 'P' Word ending in "orn", ah-ah...!??, oops, hum, OK, that might explain then...! :shock: )

Hum, OK, never mind...:
Pinterest, Inc. is an American social media web and mobile application company. It operates a software system designed to enable saving and discovery of information on the World Wide Web using images and, on a smaller scale, GIFs and videos. The site was founded by Ben Silbermann, Paul Sciarra, and Evan Sharp. [Wikipedia]

Users: 291 million active users
Date launched: January 2010
Type of site: Social networking service
Hum, sounds boring, I would think, won't really "motivate" me to create an Account, ah-ah...!
And the 'P' is probably for "People" then after all...

"2. How about... like... if I install some Firefox extension that puts like a virtual keyboard on the screen and then I use regular recording mode to click the keys on that virtual keyboard? Seriously, could that work?"
=> Hum, I don't know but I completely like the Idea... Find the Add-on and I'll also be interested...! 8)
(I once used a mini-Laptop for 2-3 months (lent by a Friend) but my Cat managed to knock some Glass of Wine over it and the Keyboard was completely dead, would take weeks to get a replacement Keyboard, which arrived after 3 weeks..., and only the Right-half of the Keyboard was working, all Keys on the Left still didn't do anything..., but all that time (for 2 or 3 months), I "worked" with the Window (Win7 I think) "Virtual Keyboard"..., and tja..., it was slow, because I had to use the Mouse for every single Click on every single Letter..., but it worked...! :D )

"6. So what are you saying? I could have my .iim script jump to a .js script just to execute the hard refresh, and then jump back to the .iim script and continue? Is that what you're saying? This may actually work, and the .js script may get it done without ever freezing. But did I understand you correctly?"
=> Euh, no, not really, but find the Thread and you'll understand...
And either way, yep, if "it" doesn't work from 'URL GOTO=Javascript" then calingl a mini '.js' Script, yep why not actually...
I wanted to implement stg similar several years ago to use the 'iimDispla()' Command in '.iim' Scripts... But I never implemented it..., as it meant splitting my existing '.iim' Scripts into several Sub-Scripts everywhere I would call the '.js' Script..., and passing the Content of 'iimDisplay()' + the Name of the next '.iim' Script would have been a bit of a hassle... And I think that calling the next '.iim' would reset the Display from the side Panel anyway, so my Script would have had to wait for that Display to remain visible long enough...

If the Clear Cache had worked, you could have used a mini dedicated FF-Profile where you don't care about losing Cookies, etc...

About the Script "sliding and looping" without doing anything, I also have that with one of my Scripts on a specific Page, but I always start that Script manually, so I notice quickly when it happens, I do the Refresh myself manually (not Hard) and then it works... I think when it happens, that some Background JS didn't finish to load and that some Buttons don't get activated...
But in your Case, you could implement some Conditional 'PROMPT' or Sound to alert you that stg is going wrong, if for example the Time measured by 'STOPWATCH LABEL' + '!STOPWATCHTIME' is "too short"...

Or maybe your '!TIMEOUT_PAGE' is too short when it happens, maybe because of the Server (or one of the 3rd Party Servers) being a bit slow at this moment, and the Page doesn't have enough time each time to fully load, especially when bypassing the Cache...
- (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...
chivracq
Posts: 9311
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Do keypress without EVENT mode?

Post by chivracq » Sat Nov 23, 2019 6:52 pm

Ah...!, and some other "Idea" I had had, was maybe to have a look at 'Greasemonkey' if maybe it would be able to force the Hard Refresh each time you visit that Site... :idea:

And here is the Thread from Advanced User @davidpoor I was referring to...:
- How to simulate a keypress using Javascript
(I had it in my Bookmarks, ah-ah...! 8) )
- (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...
Legalien
Posts: 100
Joined: Mon Feb 15, 2016 6:47 pm
Contact:

Re: Do keypress without EVENT mode?

Post by Legalien » Wed Nov 27, 2019 10:27 pm

I tried finding a virtual keyboard extension for Firefox that remains on the page at all times, but to my surprise I didn't really find anything.

Calling a .js script may work, but as you said I would have to chop up my iim scripts to do it. What do you mean "calling the next '.iim' would reset the Display from the side Panel anyway." Okay actually you make a good point... I think that if this is done, after a script jumps iim -> js -> iim then if I click Stop, no script will be "selected" on the side panel. This would create another problem for me with an Autohotkey script I have which clicks Play/Start if any of my scripts on any of my browsers freezes. It could also create an issue for me for the datasource looping.

I saw that thread - viewtopic.php?t=19233

I tried it. I tried various things with it, and none of them worked. Actually the script runs without throwing any errors, but no clicks happen or anything. So this may work, but I don't have the skills to make it work.

At the end of the day Greasemonkey may be the solution actually. I just worry that if I "inject" a greasemonkey hard refresh while my iMacro script is running, then the iMacro script may freeze. I know iMacro scripts don't like if you for example open/close a tab while a script is running, the script will freeze. But not sure if having Gresemonkey throw in a hard refresh while a script is running will cause any problems.
Buy Social Media Services - https://Socialesale.com
Post Reply