Xema Posted January 27, 2017 Share Posted January 27, 2017 Hi guys, Here is the context of my problem: I have an IE window that opens several tabs (in fact, a lot, around 50). I am navigating through the tabs (with ControlSend "^i") and wish to get the innertext of the current displayed tab. However what comes from the _IEPropertyGet($global_ie, "innertext") command is every time the innertext of the first tab (the one the IE has been created with). My question is: how to get the focus of the current tab? Some constraints I have: I cannot doing graphical things since the IE window is going to be hidden I cannot refresh/reload the tabs/pages (with 50 tabs, it ends up with too much requests and being caught by the anti-DDOS bot of the website) I cannot open the tabs in different IE (too many tabs, not sure my PC can handle 50 IEs at once) Additional informations: Tabs are created using the Navigate2 function (with the parameter "0x1000") I navigate through the tabs using the function ControlSend( ... , "^$i) I am quite new using Autoit (and any automation tools), so it is possible I didn't understand some fundamentals things. Thanks a lot guys! Xema Link to comment Share on other sites More sharing options...
Danp2 Posted January 27, 2017 Share Posted January 27, 2017 Can you provide some details on the site (ie: URL) and why you need 50 tabs? FWIW, I have used the following to retrieve the active tab in IE -- Func _IEGetActiveTab() Local $hwnd, $i, $title, $oIE ; get first IE instance $oIE = _IEAttach ("", "instance", 1) If @error = $_IESTATUS_Success Then ; get window title $hwnd = _IEPropertyGet($oIE, "hwnd") $title = WinGetTitle($hwnd) ;strip off trailing browser text $i = StringInStr($title, ' - ', 0, -1) If $i > 0 Then $title = StringLeft($title, $i - 1) EndIf $oIE = _IEAttach($title, "windowtitle") EndIf Return $oIE EndFunc Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Xema Posted January 27, 2017 Author Share Posted January 27, 2017 (edited) Thanks for your answer. Here is a sample of code I used with your function (I added inside a ConsoleWrite) : <snip> Here are the results: Google Google Google Whereas it was supposed to give "Google | Yahoo | Google" Any thoughts ? Edited January 27, 2017 by JLogan3o13 Link to comment Share on other sites More sharing options...
Xema Posted January 27, 2017 Author Share Posted January 27, 2017 I found what was wrong, it was happening too fast! After adding some delays, it all worked out. And I used your function in my main project, and it works as well. Many thanks! Link to comment Share on other sites More sharing options...
Danp2 Posted January 27, 2017 Share Posted January 27, 2017 Glad the function worked for you. Still curious what web site you are accessing with 50 tabs. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Xema Posted January 27, 2017 Author Share Posted January 27, 2017 Oh. I was doing a spectacting bot for Pokemon Showdown. At the moment, there are 50-ish high elo games running at the same time. Link to comment Share on other sites More sharing options...
Danp2 Posted January 27, 2017 Share Posted January 27, 2017 I was guessing it was something like that. You should read the forum rules before posting again on this subject. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted January 27, 2017 Moderators Share Posted January 27, 2017 @Xema, Danp2 is quite right. Please read through the forum rules, especially the part on game automation, before you post again. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts