luger Posted November 17, 2014 Share Posted November 17, 2014 (edited) Example #include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) $oIE.Quit 2 tab is opened. But I can not close the second tab? Instead turns off first.. I do not know good english.. Help me.. Edited November 17, 2014 by luger Link to comment Share on other sites More sharing options...
JayHawkfl Posted November 17, 2014 Share Posted November 17, 2014 Looks like even though you navigated to the new /forums page $oIE is still set to autoitscript.com so to close out the new game you need to specify it a variable and tell autoit to close that $var luger 1 Thanks for your time Link to comment Share on other sites More sharing options...
Palestinian Posted November 17, 2014 Share Posted November 17, 2014 >Here's some reading to do. luger 1 Link to comment Share on other sites More sharing options...
luger Posted November 17, 2014 Author Share Posted November 17, 2014 Looks like even though you navigated to the new /forums page $oIE is still set to autoitscript.com so to close out the new game you need to specify it a variable and tell autoit to close that $var The first tab instead, what should I do in order to close the second tab? Can you give examples of code?.. Link to comment Share on other sites More sharing options...
luger Posted November 17, 2014 Author Share Posted November 17, 2014 >Here's some reading to do. Previously he looked at the link.. I was mixing.. Staff can give you an example?.. Link to comment Share on other sites More sharing options...
Palestinian Posted November 17, 2014 Share Posted November 17, 2014 (edited) The first tab instead, what should I do in order to close the second tab? Can you give examples of code?.. Nope. Edited November 17, 2014 by Palestinian Link to comment Share on other sites More sharing options...
luger Posted November 17, 2014 Author Share Posted November 17, 2014 Nope. I read the link I.. I've tried a lot of things.. Unfortunately I can not.. They do not work .. Link to comment Share on other sites More sharing options...
JayHawkfl Posted November 17, 2014 Share Posted November 17, 2014 So your code snipet is this Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) $oIE.Quit The second line $oIE = is the important part. You've said I want this IE window to be marked as this variable $oIE so when in your last line you say $oIE.Quit your telling autoit to close that first window you specified to be the variable $oIE The second window you open DOES NOT have a variable name for you to tell autoit that you want to close it. You need to tell autoit what the second window is called before you can do anything with it. luger 1 Thanks for your time Link to comment Share on other sites More sharing options...
luger Posted November 17, 2014 Author Share Posted November 17, 2014 So your code snipet is this Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) $oIE.Quit The second line $oIE = is the important part. You've said I want this IE window to be marked as this variable $oIE so when in your last line you say $oIE.Quit your telling autoit to close that first window you specified to be the variable $oIE The second window you open DOES NOT have a variable name for you to tell autoit that you want to close it. You need to tell autoit what the second window is called before you can do anything with it. Okey.. How'll make it? How do I tell it? Link to comment Share on other sites More sharing options...
JayHawkfl Posted November 17, 2014 Share Posted November 17, 2014 (edited) Your telling autoit that the first window is $oIE and so when you say $oIE.quit it closes the first window Name the second window something else like $SecondIE or $NotoIE Edited November 17, 2014 by JayHawkfl luger 1 Thanks for your time Link to comment Share on other sites More sharing options...
luger Posted November 17, 2014 Author Share Posted November 17, 2014 Your telling autoit that the first window is $oIE and so when you say $oIE.quit it closes the first window Name the second window something else like $SecondIE or $NotoIE The second variable, I can not come .. How can I get a second variable ?. How can I divide it in half .. Link to comment Share on other sites More sharing options...
JayHawkfl Posted November 17, 2014 Share Posted November 17, 2014 You create a second variable. You can call it what ever you want Thanks for your time Link to comment Share on other sites More sharing options...
luger Posted November 17, 2014 Author Share Posted November 17, 2014 You create a second variable. You can call it what ever you want I suppose I could ask for help if I could. Link to comment Share on other sites More sharing options...
DaleHohm Posted November 17, 2014 Share Posted November 17, 2014 #include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") _IEQuit($oIE2) luger, mLipok and Palestinian 3 Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
luger Posted November 17, 2014 Author Share Posted November 17, 2014 (edited) #include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") _IEQuit($oIE2) Thank you.. It works .. But there is a problem.. #include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) ;-->Does not wait for page load _IELoadWait($oIE) ; --> Does not work.. :( $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") ;--> Warning, $_IEStatus_NoMatch _IEQuit($oIE2) ;--> Error, $_IEStatus_InvalidDataType How do we overcome this? How do we make the wait for pages to load?.. Note: @AutoItVersion ;-->v3.3.12.0 And $ie_version ;-->v8.0 Edited November 17, 2014 by luger Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2014 Moderators Share Posted November 17, 2014 I've messed with this before a couple of years ago. I had to enum through the IE objects and match it up that way. luger 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
luger Posted November 17, 2014 Author Share Posted November 17, 2014 I've messed with this before a couple of years ago. I had to enum through the IE objects and match it up that way. My English is not good.. I can quite understand you more or less.. How about some _IELoadWait tab feature? Or How about some _IEQuit tab feature?.. Link to comment Share on other sites More sharing options...
DaleHohm Posted November 17, 2014 Share Posted November 17, 2014 The .Navigate method has no return value, so you must attach to the new IE on your own. I'd suggest that you put the _IEAttach into a loop, waiting for the new window to be found. Something like: While 1 $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") If IsObj($oIE2) Then ExitLoop WEND SmOke_N's method will work too. Dale luger 1 Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted November 17, 2014 Moderators Share Posted November 17, 2014 (edited) Fun times... expandcollapse popup#include <IE.au3> Const $ie_new_in_tab = 0x0800 $oIE = _IECreate("http://www.autoitscript.com") _IELoadWait($oIE) __IENavigate($oIE, "http://www.autoitscript.com/forum/", 1, 0x0800) ; [n] = the object to the tab Global $ga_IETabs = 0 $ga_IETabs = __IE_TabLoadWait($oIE, "http://www.autoitscript.com/forum/", "url") If @error Then Exit 101 Local $go_NewTab = $ga_IETabs[1] ; I know it's only returning 1 _IEQuit($go_NewTab) ; this will return the objects of the tabs matching type/str and wait if need be Func __IE_TabLoadWait(ByRef $o_obj, $s_str = "", $s_type = "", $n_msecexpire = 0) If Not IsObj($o_obj) Then Return SetError(1, 0, 0) EndIf Local $a_objret = 0 Local $n_timer = TimerInit() While 1 $a_objret = __IE_GetTabObjs($o_obj, $s_str, $s_type) If IsArray($a_objret) Then ExitLoop ; return if we set the wait timer and it's reached If $n_msecexpire > 0 Then If $n_timer >= $n_msecexpire Then Return SetError(2, 0, 0) EndIf EndIf Sleep(250) WEnd If Not IsArray($a_objret) Then Return SetError(3, 0, 0) EndIf ; set normal _ieloadwait default If $n_msecexpire < 1 Then $n_msecexpire = -1 For $i = 1 To UBound($a_objret) - 1 _IELoadWait($a_objret[$i], 0, $n_msecexpire) Next ; this could return multiple if there is more than 1 tab ; with the same url/title for $s_type passed Return $a_objret EndFunc ; returns all the instances of tabs matching type/str criteria Func __IE_GetTabObjs(ByRef $o_obj, $s_str = "", $s_type = "") If Not IsObj($o_obj) Then Return SetError(1, 0, 0) EndIf Local $a_otabs[101], $i_add = 0, $i_next = 1, $o_ieattach $s_type = StringLower($s_type) While 1 ; we start at instance 1 and enum as we find more instances $o_ieattach = _IEAttach($o_obj, "instance", $i_next + 1) If @error = $_IEStatus_NoMatch Or Not IsObj($o_ieattach) Then ExitLoop ; control array size If Mod($i_add + 1, 100) = $i_add Then ReDim $a_otabs[$i_add + 101] EndIf Switch StringLower($s_type) Case "url" If String(Execute("$o_ieattach.locationurl")) = $s_str Then $i_add += 1 $a_otabs[$i_add] = $o_ieattach EndIf Case "title" If WinGetText(String(Execute("$o_ieattach.hwnd"))) = $s_str Then $i_add += 1 $a_otabs[$i_add] = $o_ieattach EndIf Case Else $i_add += 1 $a_otabs[$i_add] = $o_ieattach EndSwitch $i_next += 1 WEnd If $i_add = 0 Then Return SetError(2, 0, 0) ReDim $a_otabs[$i_add + 1] $a_otabs[0] = $i_add Return $a_otabs EndFunc Edited November 17, 2014 by SmOke_N luger 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Solution luger Posted November 17, 2014 Author Solution Share Posted November 17, 2014 (edited) The .Navigate method has no return value, so you must attach to the new IE on your own. I'd suggest that you put the _IEAttach into a loop, waiting for the new window to be found. Something like: While 1 $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") If IsObj($oIE2) Then ExitLoop WEND SmOke_N's method will work too. Dale Thank you.. It works .. Full version: #include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) While 1 $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") ;--> IE.au3 T3.0-1 Warning from function _IEAttach, $_IESTATUS_NoMatch :) If IsObj($oIE2) Then ExitLoop WEND _IEQuit($oIE2) ; Or $oIE2.Quit Full version2: #include <IE.au3> Const $ie_new_in_tab=0x0800 $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) While 1 $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") ;--> IE.au3 T3.0-1 Warning from function _IEAttach, $_IESTATUS_NoMatch :) If IsObj($oIE2) Then ExitLoop WEND Sleep(500) Send("^w") ; Tab close.. :) Full version3-No warnings: #include <IE.au3> Const $ie_new_in_tab=0x0800 _IEErrorNotify(0) ;-->No warnings.. :) $oIE = _IECreate("http://www.autoitscript.com") $oIE.Navigate("http://www.autoitscript.com/forum/", $ie_new_in_tab) While 1 $oIE2 = _IEAttach("http://www.autoitscript.com/forum/", "url") If IsObj($oIE2) Then ExitLoop WEND $oIE2.Quit Edited November 17, 2014 by luger 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