Jump to content
Sign in to follow this  
twinxz

Clicking a button in context menu of Firefox

Recommended Posts

twinxz

Hey. I've made a script that right-clicks on hotkey press, then selects a button in context menu by sending {DOWN} five times, then presses it with {ENTER}. However, I got a very persistent and extremely annoying issue when sometimes Send("{DOWN}") misses the context menu somehow and scrolls the page instead, even though the menu had opened and there's no reason for that to happen. I've tried to increase Sleep timer between actions to the point when it's obviously that the delay there is irrelevant. I've been bashing my head for half a day and I still can't figure out why does it happen. It fails about 3 times out of 10.

I figure my best option here would be making my script recognize the context menu, find the button there and click it, and it appears to be possible to do with AutoIt, but I have completely failed to achive my goal. Firefox is displaying the page header in its window title, so I don't even know how to take control over its window without chaging the script accordingly everytime.

I believe that is actually something extremely easy to do and I'm just too dumb to figure out how. Would somebody be so kind to give me a direction in which I should be working here?

Share this post


Link to post
Share on other sites
twinxz

So basically, that part of my script looks like this:

MouseClick("right")

Sleep(500)

$i = 0

Do

Send("{DOWN}")

Sleep(100)

$i += 1

Until $i = 6

Sleep(250)

Send("{ENTER}")

And I do not understand these two things:

1) How to get control of Firefox window if its title is dynamic?

2) What would be the easiest way of recognizing the context menu and pressing a button in it?

Edited by twinxz

Share this post


Link to post
Share on other sites
KaFu

Get main Firefox window handle:

Maybe give this keyconfig.xpi plugin I use a try. It allows you to bind every standard command to a key, those should be more easily and reliably to be automated (just try to send them to the Firefox main window handle).

Edited by KaFu

Share this post


Link to post
Share on other sites
water

Or you could have a look at the Firefox UDF in the Example Scripts forum. It lets you automate Firefox reliably.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×