twinxz Posted March 31, 2013 Share Posted March 31, 2013 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? Link to comment Share on other sites More sharing options...
twinxz Posted March 31, 2013 Author Share Posted March 31, 2013 (edited) 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 March 31, 2013 by twinxz Link to comment Share on other sites More sharing options...
KaFu Posted March 31, 2013 Share Posted March 31, 2013 (edited) 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 March 31, 2013 by KaFu OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
water Posted March 31, 2013 Share Posted March 31, 2013 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now