JSThePatriot Posted August 3, 2008 Share Posted August 3, 2008 Hello everyone, it has been a long time since I have had to ask for help on these forums, and honestly it's been a while since I have been actively using AutoIt. I am happy to be using it again, but I think I am a bit rusty. Thanks for any and all help, tips, and/or suggestions. I am trying to use a script to open and close tabs 5 at a time. I know with IE 7 you can script the opening of tabs. I don't think IE.au3 is up to date with IE 7, but I have tried a couple of different ways to make this work, and the first time through the loop it works, but the second time through it doesn't. Below are the few configurations that I have tried. Some of them open up the first 5, and then the script dies at the end of the Navigate2() function call. Some of them will end up closing out of IE, and then the script fails. I always have 1 tab open before I open 5 so it should never close out of IE. My preferred method would be 2 or 3, but I am unable to get those to work past the first time through the for loop to the If with the Mod() function. Configuration 1 expandcollapse popupDim $URL Dim $IE, $navOpenInBackgroundTab, $navOpenInNewTab $navOpenInNewTab = 0x0800 $navOpenInBackgroundTab = 0x1000 $IE = ObjCreate("InternetExplorer.Application") $IE.Visible = True $IE.Navigate2("about:blank") For $i = 1 to 10000 Step 1 $URL = 'http://www.google.com/search?q=' & $i $IE.Navigate2($URL, $navOpenInBackgroundTab) Sleep(300) If (Mod($i, 5) == 0) Then Sleep(1000) WinActivate("Internet Explorer") Sleep(1000) Send("^w") Sleep(750) Send("^w") Sleep(750) Send("^w") Sleep(750) Send("^w") Sleep(750) Send("^w") EndIf NextoÝ÷ Ø*'~(.«b¢}ºÚ"µÍ[H ÌÍÕT[H ÌÍÒQK ÌÍÛ]Ü[[XÚÙÜÝ[X ÌÍÛ]Ü[[]ÕXÌÍÛ]Ü[[]ÕXHÌÍÛ]Ü[[XÚÙÜÝ[XHLÌÍÒQHHÒQP]XÚ ][ÝÒ[]^Ü][ÝË ][ÝÕÚ[ÝÕ]I][ÝÊBÜ ÌÍÚHHHÈLÝB ÌÍÕTH ÌÎNÚËÝÝÝËÛÛÙÛKÛÛKÜÙXÚÜOIÌÎNÈ [È ÌÍÚB ÌÍÒQK]YØ]L ÌÍÕT ÌÍÛ]Ü[[XÚÙÜÝ[XBÛY Ì BY [Ù ÌÍÚK JHOH H[ÛY L BÚ[XÝ]]J ][ÝÒ[]^Ü][ÝÊBÛY L BÙ[ ][Ý×É][ÝÊBÛY ÍL BÙ[ ][Ý×É][ÝÊBÛY ÍL BÙ[ ][Ý×É][ÝÊBÛY ÍL BÙ[ ][Ý×É][ÝÊBÛY ÍL BÙ[ ][Ý×É][ÝÊB[Y^oÝ÷ Ø*'~(.«b¢}ÚºÚ"µÍ[H ÌÍÕT[H ÌÍÒQK ÌÍÛ]Ü[[XÚÙÜÝ[X ÌÍÛ]Ü[[]ÕXÌÍÛ]Ü[[]ÕXHÌÍÛ]Ü[[XÚÙÜÝ[XHLÜ ÌÍÚHHHÈLÝB ÌÍÕTH ÌÎNÚËÝÝÝËÛÛÙÛKÛÛKÜÙXÚÜOIÌÎNÈ [È ÌÍÚB ÌÍÒQHHÒQP]XÚ ][ÝÒ[]^Ü][ÝË ][ÝÕÚ[ÝÕ]I][ÝÊB ÌÍÒQK]YØ]L ÌÍÕT ÌÍÛ]Ü[[XÚÙÜÝ[XBÛY Ì BY [Ù ÌÍÚK JHOH H[ÛY L BÚ[XÝ]]J ][ÝÒ[]^Ü][ÝÊBÛY L BÙ[ ][Ý×É][ÝÊBÛY ÍL BÙ[ ][Ý×É][ÝÊBÛY ÍL BÙ[ ][Ý×É][ÝÊBÛY ÍL BÙ[ ][Ý×É][ÝÊBÛY ÍL BÙ[ ][Ý×É][ÝÊB[Y^ If anyone has any insight into this, please let me know, and thanks in advance. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
JSThePatriot Posted August 3, 2008 Author Share Posted August 3, 2008 Dale, Thanks for your response. I know you are formulating it now. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
DaleHohm Posted August 3, 2008 Share Posted August 3, 2008 (edited) There is undocumented support for this in IE.au3 -- it doesn't fit well with the rest of the operation of IE.au3 and I am working on a redesign. In the mean time, you can search in IE.au3 for __IENavigate (note the 2 _'s). If you pass in a flag of 0x0800 it will open a new browser instance in a new tab. expandcollapse popup;=============================================================================== ; ; Function Name: __IENavigate() ; Description: ** Unsupported version of _IENavigate (note second underscore in name) ; ** Last 4 parameters insufficiently tested. ; ** - Flags and Target can create new windows and new browser object - causing confusion ; ** - Postdata needs SAFEARRAY and we have no way to create one ; Directs an existing browser window to navigate to the specified URL ; Parameter(s): $o_object - Object variable of an InternetExplorer.Application, Window or Frame object ; $s_Url - URL to navigate to (e.g. "http://www.autoitscript.com") ; $f_wait - Optional: specifies whether to wait for page to load before returning ; 0 = Return immediately, not waiting for page to load ; 1 = (Default) Wait for page load to complete before returning ; $i_flags - URL to navigate to (e.g. "http://www.autoitscript.com") ; $s_target - URL to navigate to (e.g. "http://www.autoitscript.com") ; $spostdata - URL to navigate to (e.g. "http://www.autoitscript.com") ; $s_headers - URL to navigate to (e.g. "http://www.autoitscript.com") ; Requirement(s): AutoIt3 V3.2 or higher ; Return Value(s): On Success - Returns -1 ; On Failure - Returns 0 and sets @ERROR ; @ERROR - 0 ($_IEStatus_Success) = No Error ; - 1 ($_IEStatus_GeneralError) = General Error ; - 3 ($_IEStatus_InvalidDataType) = Invalid Data Type ; - 4 ($_IEStatus_InvalidObjectType) = Invalid Object Type ; - 6 ($_IEStatus_LoadWaitTimeout) = Load Wait Timeout ; - 8 ($_IEStatus_AccessIsDenied) = Access Is Denied ; - 9 ($_IEStatus_ClientDisconnected) = Client Disconnected ; @Extended - Contains invalid parameter number ; Author(s): Dale Hohm ; ; http://msdn.microsoft.com/workshop/browser/webbrowser/reference/enums/browsernavconstants.asp ; ; Flags: ; navOpenInNewWindow = 0x1, ; navNoHistory = 0x2, ; navNoReadFromCache = 0x4, ; navNoWriteToCache = 0x8, ; navAllowAutosearch = 0x10, ; navBrowserBar = 0x20, ; navHyperlink = 0x40, ; navEnforceRestricted = 0x80, ; navNewWindowsManaged = 0x0100, ; navUntrustedForDownload = 0x0200, ; navTrustedForActiveX = 0x0400, ; navOpenInNewTab = 0x0800, ; navOpenInBackgroundTab = 0x1000, ; navKeepWordWheelText = 0x2000 ; ;=============================================================================== Dale Edited August 3, 2008 by DaleHohm 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...
JSThePatriot Posted August 3, 2008 Author Share Posted August 3, 2008 Dale, That never opened any tabs, but it did eventually end up closing IE due to the CTRL+W that I am using to close out open tabs...any other suggestions? Thanks, Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
DaleHohm Posted August 3, 2008 Share Posted August 3, 2008 Dale, That never opened any tabs, but it did eventually end up closing IE due to the CTRL+W that I am using to close out open tabs...any other suggestions? Thanks, JarvisSorry, don't know what you mean "that never opened any tabs" -- show you code... or try this: $oIE = _IECreate("www.autoitscript.com") __IENavigate($oIE, "www.google.com", 0, 0x800) __IENavigate($oIE, "www.dogpile.com", 0, 0x800) __IENavigate($oIE, "www.ebay.com", 0, 0x800) Dale 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...
JSThePatriot Posted August 3, 2008 Author Share Posted August 3, 2008 Sorry, don't know what you mean "that never opened any tabs" -- show you code... or try this: $oIE = _IECreate("www.autoitscript.com") __IENavigate($oIE, "www.google.com", 0, 0x800) __IENavigate($oIE, "www.dogpile.com", 0, 0x800) __IENavigate($oIE, "www.ebay.com", 0, 0x800)oÝ÷ Ø6¥{ú®¢×jWjk(®¼jkbçZ×bv}ý¶,¶Ø^r^"ÚâyÖ®¶sdFÒb33cµU$À¤FÒb33c´RÂb33c¶æd÷Vää&6¶w&÷VæEF"Âb33c¶æd÷VääæWuF ¢b33c¶æd÷VääæWuF"Ò¢b33c¶æd÷Vää&6¶w&÷VæEF"Ò ¤f÷"b33c¶ÒFò7FW¢b33cµU$ÂÒb33¶GG¢ò÷wwrævöövÆRæ6öÒ÷6V&6÷Òb33²fײb33c¶¢b33c´RÒôTGF6gV÷C´çFW&æWBWÆ÷&W"gV÷C²ÂgV÷CµvæF÷uFFÆRgV÷C²¢õôTæfvFRb33c´RÂb33cµU$ÂÂÂb33c¶æd÷Vää&6¶w&÷VæEF"¢6ÆVW3¢bÖöBb33c¶ÂRÓÒFVà¢6ÆVW¢vä7FfFRgV÷C´çFW&æWBWÆ÷&W"gV÷C²¢6ÆVW¢6VæBgV÷CµçrgV÷C²¢6ÆVWsS¢6VæBgV÷CµçrgV÷C²¢6ÆVWsS¢6VæBgV÷CµçrgV÷C²¢6ÆVWsS¢6VæBgV÷CµçrgV÷C²¢6ÆVWsS¢6VæBgV÷CµçrgV÷C²¢VæD`¤æW Thanks for trying to help thus far! I knew you would be on this thread. Thanks again, JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
DaleHohm Posted August 3, 2008 Share Posted August 3, 2008 What are you trying to do? Sorry it isn't clear to me from your code. what are you having trouble with? Is it the closing of the windows? If so, use _IEAttach and _IEQuit instead of ^w Dale 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...
JSThePatriot Posted August 4, 2008 Author Share Posted August 4, 2008 What are you trying to do? Sorry it isn't clear to me from your code. what are you having trouble with? Is it the closing of the windows? If so, use _IEAttach and _IEQuit instead of ^wDaleDale I am sorry, I am trying to automate going to different pages using a For loop with a number. I decided for my example google would make sense as the website doesn't matter...its what the code is doing. I want to open 5 pages at a time, and then close those 5 tabs. I can get my loop to go through once, and it works perfectly, however when it comes around for try two it exits the script with an error relating to the Navigate2() function call. My samples should work, it's what I am using. The only thing not in the sample is the #include <IE.au3>.Thanks,Jarvis AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
DaleHohm Posted August 4, 2008 Share Posted August 4, 2008 Interesting challenge... give this a try: #include <IE.au3> $navOpenInNewTab = 0x0800 $navOpenInBackgroundTab = 0x1000 $oIE = _IECreate("www.google.com") Dim $aIE[5] _IEErrorNotify(False) For $i = 1 to 10 Step 1 __IENavigate($oIE, "about:blank" & $i, 1, $navOpenInBackgroundTab) Do $aIE[Mod($i, 5)] = _IEAttach("about:blank" & $i, "url") Sleep(100) Until IsObj($aIE[Mod($i, 5)]) _IENavigate($aIE[Mod($i, 5)], 'http://www.google.com/search?q=' & $i) If (Mod($i, 5) == 0) Then For $j = 0 to 4 _IELoadWait($aIE[$j]) _IEQuit($aIE[$j]) Next EndIf Next Dale 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...
JSThePatriot Posted August 5, 2008 Author Share Posted August 5, 2008 Interesting challenge... give this a try: #include <IE.au3> $navOpenInNewTab = 0x0800 $navOpenInBackgroundTab = 0x1000 $oIE = _IECreate("www.google.com") Dim $aIE[5] _IEErrorNotify(False) For $i = 1 to 10 Step 1 __IENavigate($oIE, "about:blank" & $i, 1, $navOpenInBackgroundTab) Do $aIE[Mod($i, 5)] = _IEAttach("about:blank" & $i, "url") Sleep(100) Until IsObj($aIE[Mod($i, 5)]) _IENavigate($aIE[Mod($i, 5)], 'http://www.google.com/search?q=' & $i) If (Mod($i, 5) == 0) Then For $j = 0 to 4 _IELoadWait($aIE[$j]) _IEQuit($aIE[$j]) Next EndIf Next DaleDale, This did wonders for me! Thanks so much! JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) 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