Prev: Script
Next: Script for IBM AS/400 session keystrokes
From: AvWG on 8 Nov 2009 05:56 Hi, With vbscript I.ve created the following: I start the IE-application, use sendkeys to login in on a site. Next I create 10 more tabs (internet-pages), each with slightly another address. When this is done I want to go to the 2nd tab, save the source information and do this for the rest of the 9 remaining tabs.... The problem is: I can't get the focus off the first (login) tab. Though I can go to the next tab with sendkeys :-( , the html-source I want to review is still of the first tab... Manually I can click on the tabs and get the source. But first this time consuming and second I want to read many more internetpages/tabs then the 10 I mentioned. So is there a vbscript-"command" to switch to other tabs? Part of the script: Set oIE = CreateObject("InternetExplorer.Application") ', "oIE_") oIE.Visible = True oIE.FullScreen = False 'open a new window oIE.Navigate2 aLinks(0) Do While oIE.Busy WScript.Sleep 50 Loop 'open url In new tab Logon() ' My own logon subroutine WScript.Sleep 2000 For J=1 To 9 oIE.Navigate2 aLinks(J), navOpenInBackgroundTab 'navOpenInNewTab ' Do While oIE.Busy WScript.Sleep 50 Loop WScript.Sleep 3000 Next WshShell.SendKeys "^{TAB}" 'go to the 2nd tab WScript.Sleep 100 on error goto 0 WScript.Sleep 2000 WScript.Echo "***********************************************************" Here I used code as oIE.Document.body.innerHTML or Set oHTML = CreateObject("Microsoft.XMLHTTP") oHTML.open "GET" , sURL, True Does anybody have suggestions how to stear between the tabs? I hope so, Andr�
From: Robert Aldwinckle on 8 Nov 2009 08:43 "AvWG" <dretrain(a)hotmail.com> wrote in message news:263af$4af6a406$5352a1ff$29878(a)cache4.tilbu1.nb.home.nl... > WshShell.SendKeys "^{TAB}" 'go to the 2nd tab > Does anybody have suggestions how to stear between the tabs? Not that way. That depends on your tab setting for Always switch to new tabs when they are created (Alt-T,O,Alt-,t,A) and your setting for Use most recent order when switching tabs with Ctrl+Tab (in Options, Advanced, Browsing section) Your use of the mouse ("click on the tabs") ignores these factors and is not a good comparison in any case. At the very least you should be simulating using keystrokes what you are attempting to achieve using SendKeys. A more reliable way to switch between 9 tabs is to use Ctrl-1 through Ctrl-9. I think that use of those keys could be easily adapted to a SendKeys implementation. Good luck Robert Aldwinckle ---
From: AvWG on 8 Nov 2009 11:00 Hi Robert, Thank you for your quick response. I used sendkeys but it seemed not to change the focus...... My expections were more into IE-object methods/properties and /or IE.Document methods/properties. I am looking for some answers that don't use the sendkey construction, but more like oIE.Tab(x).SetFocus and oIE.Tab(x).GetSource..... For now they only exist in my imagination. Andr� "Robert Aldwinckle" <robald(a)techemail.com> schreef in bericht news:e2hFCmHYKHA.4360(a)TK2MSFTNGP04.phx.gbl... > > "AvWG" <dretrain(a)hotmail.com> wrote in message > news:263af$4af6a406$5352a1ff$29878(a)cache4.tilbu1.nb.home.nl... > >> WshShell.SendKeys "^{TAB}" 'go to the 2nd tab > >> Does anybody have suggestions how to stear between the tabs? > > > Not that way. That depends on your tab setting for > > Always switch to new tabs when they are created > (Alt-T,O,Alt-,t,A) > > and your setting for > > Use most recent order when switching tabs with Ctrl+Tab > (in Options, Advanced, Browsing section) > > Your use of the mouse ("click on the tabs") ignores these factors > and is not a good comparison in any case. At the very least you > should be simulating using keystrokes what you are attempting > to achieve using SendKeys. > > A more reliable way to switch between 9 tabs is to use > Ctrl-1 through Ctrl-9. I think that use of those keys could be > easily adapted to a SendKeys implementation. > > > > Good luck > > Robert Aldwinckle > --- > >
From: mayayana on 8 Nov 2009 11:41 I can't answer your question in terms of tabs, but why not just navigate to the pages in series? That's what you would have had to have done anyway before there were tabs. It seems more dependable than the method you're trying to use. Sendkeys is a hokey, unpredictable method, best avoided whenever possible. > > Thank you for your quick response. > > I used sendkeys but it seemed not to change the focus...... > > My expections were more into IE-object methods/properties and /or > IE.Document methods/properties. I am looking for some answers that don't use > the sendkey construction, but more like oIE.Tab(x).SetFocus and > oIE.Tab(x).GetSource..... > > For now they only exist in my imagination. > > Andr� > > "Robert Aldwinckle" <robald(a)techemail.com> schreef in bericht > news:e2hFCmHYKHA.4360(a)TK2MSFTNGP04.phx.gbl... > > > > "AvWG" <dretrain(a)hotmail.com> wrote in message > > news:263af$4af6a406$5352a1ff$29878(a)cache4.tilbu1.nb.home.nl... > > > >> WshShell.SendKeys "^{TAB}" 'go to the 2nd tab > > > >> Does anybody have suggestions how to stear between the tabs? > > > > > > Not that way. That depends on your tab setting for > > > > Always switch to new tabs when they are created > > (Alt-T,O,Alt-,t,A) > > > > and your setting for > > > > Use most recent order when switching tabs with Ctrl+Tab > > (in Options, Advanced, Browsing section) > > > > Your use of the mouse ("click on the tabs") ignores these factors > > and is not a good comparison in any case. At the very least you > > should be simulating using keystrokes what you are attempting > > to achieve using SendKeys. > > > > A more reliable way to switch between 9 tabs is to use > > Ctrl-1 through Ctrl-9. I think that use of those keys could be > > easily adapted to a SendKeys implementation. > > > > > > > > Good luck > > > > Robert Aldwinckle > > --- > > > > > >
From: AvWG on 8 Nov 2009 12:48
Hi Mayayana, Indeed sendkeys are to be avoided. I am looking for the 'just navigate' you mentioned. I start IE with the logon page. After a few secondes I start the second tab/internet page of which I want the html-source. But for now first the eight remaining pages are called For J=1 To 9 oIE.Navigate2 aLinks(J), navOpenInBackgroundTab . .. After this the actual source-getting is started: place the focus on page 2, read source, parse source, focus on page 3, read source etc.. That navigating to the next page, is what I want.... Tnx for your answer, Andr� "mayayana" <mayaXXyana(a)rcXXn.com> schreef in bericht news:O1bvrIJYKHA.3504(a)TK2MSFTNGP05.phx.gbl... > I can't answer your question in terms > of tabs, but why not just navigate to > the pages in series? That's what you would > have had to have done anyway before there > were tabs. It seems more dependable than > the method you're trying to use. Sendkeys > is a hokey, unpredictable method, best > avoided whenever possible. > >> >> Thank you for your quick response. >> >> I used sendkeys but it seemed not to change the focus...... >> >> My expections were more into IE-object methods/properties and /or >> IE.Document methods/properties. I am looking for some answers that don't > use >> the sendkey construction, but more like oIE.Tab(x).SetFocus and >> oIE.Tab(x).GetSource..... >> >> For now they only exist in my imagination. >> >> Andr� >> >> "Robert Aldwinckle" <robald(a)techemail.com> schreef in bericht >> news:e2hFCmHYKHA.4360(a)TK2MSFTNGP04.phx.gbl... >> > >> > "AvWG" <dretrain(a)hotmail.com> wrote in message >> > news:263af$4af6a406$5352a1ff$29878(a)cache4.tilbu1.nb.home.nl... >> > >> >> WshShell.SendKeys "^{TAB}" 'go to the 2nd tab >> > >> >> Does anybody have suggestions how to stear between the tabs? >> > >> > >> > Not that way. That depends on your tab setting for >> > >> > Always switch to new tabs when they are created >> > (Alt-T,O,Alt-,t,A) >> > >> > and your setting for >> > >> > Use most recent order when switching tabs with Ctrl+Tab >> > (in Options, Advanced, Browsing section) >> > >> > Your use of the mouse ("click on the tabs") ignores these factors >> > and is not a good comparison in any case. At the very least you >> > should be simulating using keystrokes what you are attempting >> > to achieve using SendKeys. >> > >> > A more reliable way to switch between 9 tabs is to use >> > Ctrl-1 through Ctrl-9. I think that use of those keys could be >> > easily adapted to a SendKeys implementation. >> > >> > >> > >> > Good luck >> > >> > Robert Aldwinckle >> > --- >> > >> > >> >> > > |