wouteronline55 Posted February 18, 2013 Posted February 18, 2013 The situation: - 1 PC - 2 monitors - 2 Chrome browser windows with 2 tabs each (the same) What I need: - Switch tabs in both Chrome browser windows. I already tried different things, but I can't get it to work in both browser windows. Can anyone help me out?
water Posted February 18, 2013 Posted February 18, 2013 Welcome to AutoIt and the forum!I already tried different things, but I can't get it to work in both browser windows.Can you post what you tried so far? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
wouteronline55 Posted February 18, 2013 Author Posted February 18, 2013 Welcome to AutoIt and the forum!Can you post what you tried so far?I've been working with simulating CTRL + TAB, but that only works for the window that is active, not the second window. Also, worked with "If WinExists("title","unique text from left most tab") then ControlCommand and TabRight" (found in other topic) but can't get it to work.
water Posted February 18, 2013 Posted February 18, 2013 If you want to send keystrokes you need to activate the respective window.Search the forum for "Chrome UDF" and you will find some threads about My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
wouteronline55 Posted February 18, 2013 Author Posted February 18, 2013 If you want to send keystrokes you need to activate the respective window.Search the forum for "Chrome UDF" and you will find some threads about Thanks. However, what the difficult think for me is that there are 2 browser windows with each the same 2 tabs open. So, the titles are 100% the same...
water Posted February 18, 2013 Posted February 18, 2013 Then use function WinList to get a list of all windows with this title. Pass the HWND to WinActivate and the send the required keys. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
water Posted February 18, 2013 Posted February 18, 2013 (edited) Example: Get a list of all windows with title "xxxx". Activate each window and send Ctrl+6 (switch to tab #6) . $aWinList = WinList("xxxx") For $i = 1 To $aWinList[0][0] If WinActivate($aWinList[$i][1]) <> 0 Then Send("^6") Next Edited February 18, 2013 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
wouteronline55 Posted February 18, 2013 Author Posted February 18, 2013 Example: Get a list of all windows with title "xxxx". Activate each window and send Ctrl+6 (switch to tab #6) . $aWinList = WinList("xxxx") For $i = 1 To $aWinList[0][0] If WinActivate($aWinList[$i][1]) <> 0 Then Send("^6") Next Thanks, that looks good. When I run it with $aWinList = WinList() it works, but when I use $aWinList = WinList("Chrome"), it doesn't.
water Posted February 18, 2013 Posted February 18, 2013 Try this one:#include <array.au3> AutoItSetOption("WinTitleMatchMode", 2) ; Match any substring in the title $aWinList = WinList("xxxx") _ArrayDisplay($aWinList) For $i = 1 To $aWinList[0][0] If WinActivate($aWinList[$i][1]) <> 0 Then Send("^6") Next My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
wouteronline55 Posted February 18, 2013 Author Posted February 18, 2013 Try this one:#include <array.au3> AutoItSetOption("WinTitleMatchMode", 2) ; Match any substring in the title $aWinList = WinList("xxxx") _ArrayDisplay($aWinList) For $i = 1 To $aWinList[0][0] If WinActivate($aWinList[$i][1]) <> 0 Then Send("^6") Next Yes, that works! Thanks a lot! Now there is 1 more challange I need to overcome: I have a infinite (While 1) loop to constantly change the tabs. In the loop, I added a sleep() to slow down the switch. However, I need to change the sleep() statement (nr. of seconds) based on the currently selected tab. What I need: if(tabname contains X){ sleep(10000) } else{ sleep(20000) } I know how to create a if/else statement, but can't find the object where the tab name is stored ("tabname contains X" in example above)...
water Posted February 18, 2013 Posted February 18, 2013 Can't you extract the name from the WIndows title? What does _ArrayDisplay return? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
wouteronline55 Posted February 18, 2013 Author Posted February 18, 2013 Can't you extract the name from the WIndows title? What does _ArrayDisplay return? Ah yes, I have $aWinList[$i][0] I can use for the matching. Now just need a commant to check if string contains "x"...
water Posted February 18, 2013 Posted February 18, 2013 StringInStr? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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