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
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.
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.....
>> 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.
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.
> 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.....
> >> 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.
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....
> 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.....
>> >> 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.
> 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
>> 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
> I used sendkeys but it seemed not to change the focus......
Did you put a waitfor in after it? ; )
> 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.
For everyone I suspect. Unless there has been something added to IE8 to support tabs by an API my understanding is that tabs are strictly the end users choice of presentation for multiple windows. I.e., a web site author should neither know nor care if there are tabs or windows or, if tabs, how they relate to each other (e.g. using the options I mentioned.) Hence, the only way that you could control such presentation would be by simulating keystrokes which you knew to be the most reliable in either case.
BTW the IE General NG is not the best forum for discussing workarounds for this limitation. I suggest you try the MSDN forum for IE web development instead.
>> I used sendkeys but it seemed not to change the focus......
> Did you put a waitfor in after it? ; )
>> 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.
> For everyone I suspect. Unless there has been something added to IE8 > to support tabs by an API my understanding is that tabs are strictly the > end users choice of presentation for multiple windows. I.e., a web site > author should neither know nor care if there are tabs or windows or, > if tabs, how they relate to each other (e.g. using the options I > mentioned.) > Hence, the only way that you could control such presentation would be > by simulating keystrokes which you knew to be the most reliable in either > case.
> BTW the IE General NG is not the best forum for discussing workarounds > for this limitation. I suggest you try the MSDN forum for IE web > development > instead.
> 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?
I've read this thread, and I don't see any justification for wanting to put the pages in different tabs. Specifically, there is no mention of user interaction. Assuming that there is no user involvement and that you are simply after information on those pages, I think you would be better off creating an IE instance for each page to which you'd like to navigate. For example, an array of IE instances which (eventually) should run hidden.
However, there is a second problem, which is already evident in your code, and that is that you are having a significant problem determining when pages are ready. This is, in general, quite a difficult issue. I think it would be far easier for you to spawn a different process for each page you'd like to load so that it can be dealt with separately. However, doing this with 10 pages or so can be a massive hit on the CPU, so I don't recommend this route.
Parallel processing of pages is really messy. Unless you have a REALLY SPECIFIC reason for needing the parallel aspect, your posted code implies that you are doing background processing. That being the case, you could just as well process each page one at a time (which also reduces the chance that the remote site will ban you for robotic access of their pages). So you could have the original IE for your starting page, and then create a second IE for your array of links (so that you can get back to your original IE when done with processing said array). Now process each link one at a time (taking into account what to do if you've gotten to some timeout limit and the page hasn't loaded).
> 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?
By the way, I haven't tried this, and I don't have a tabbed IE here to do so with, but if you click on the different tabs of IE, do you get a different title in the title bar? If so, it's conceivable (though perhaps not likely) that you could activate a specific tab through AppActivate. Has anyone tried that? I wouldn't want to take bets on it, but...
Just returned from there, and was totally impressed. Those Hapsburgs really know how to turn on the baroque decoration.
As for the Apfel Strudel mit Schlage -- I had almost forgotten what REAL Schlage tastes like. The stuff you get here in the US is just tasteless white goo that comes out of a sqray can. And the Wiener Strudel is a huge pile of apples with a paper thin crust. Contrast that with the American Strudel, which is a huge thick doughy crust, with a paper-thin layer of apples inside.
Thank you for your message. I've already done what you described. One Instance, two instances, 25 instances. But that's not the problem.
One of the problems is that it is not possible to go to the 12th tab after creating 25 tabs (with ie VBScript) .The other problem: When I use something like sendkeys and end at the 12th tab, I don't get the source of that page. What I do get is the source of the very first page I need to start, with credentials in order to have access to that particular site. Manually on that page I can click on 'Source' in the menu and get the source I want...
So no methodes to freely move between tabs and not getting the right source dump....
> 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?
I've read this thread, and I don't see any justification for wanting to put the pages in different tabs. Specifically, there is no mention of user interaction. Assuming that there is no user involvement and that you are simply after information on those pages, I think you would be better off creating an IE instance for each page to which you'd like to navigate. For example, an array of IE instances which (eventually) should run hidden.
However, there is a second problem, which is already evident in your code, and that is that you are having a significant problem determining when pages are ready. This is, in general, quite a difficult issue. I think it would be far easier for you to spawn a different process for each page you'd like to load so that it can be dealt with separately. However, doing this with 10 pages or so can be a massive hit on the CPU, so I don't recommend this route.
Parallel processing of pages is really messy. Unless you have a REALLY SPECIFIC reason for needing the parallel aspect, your posted code implies that you are doing background processing. That being the case, you could just as well process each page one at a time (which also reduces the chance that the remote site will ban you for robotic access of their pages). So you could have the original IE for your starting page, and then create a second IE for your array of links (so that you can get back to your original IE when done with processing said array). Now process each link one at a time (taking into account what to do if you've gotten to some timeout limit and the page hasn't loaded).
> 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?
By the way, I haven't tried this, and I don't have a tabbed IE here to do so with, but if you click on the different tabs of IE, do you get a different title in the title bar? If so, it's conceivable (though perhaps not likely) that you could activate a specific tab through AppActivate. Has anyone tried that? I wouldn't want to take bets on it, but...
On Nov 11, 10:32 pm, "AvWG" <dretr...@hotmail.com> wrote:
> Hi Csaba,
> Thank you for your message. I've already done what you described.
I've recommended two main things, and described a few things that I recommended against. The first recommendation was to stay away from tabs (using multiple instances or multiple invocations were two possible alternatives (but I certainly don't recommend either one)), especially by using single instance serial navigation.
The second was a possible way to get ahold of a tab (using AppActivate) if you nevertheless insist on tabs.
Which is it that you have already done?
> One Instance, two instances, 25 instances. But that's not the > problem.
> One of the problems is that it is not possible to go to the 12th tab > after creating 25 tabs (with ie VBScript).
You have not motivated the problem. What makes it compelling to create any tabs whatsoever? I'm not saying there couldn't be a reason, but without guiding our thinking a bit, it is hard to wrap our heads around why. Specifically, the internet world existed pretty well before tabs came along. They did so as a user convenience rather than a user necessity. So I would think you have to be doing something pretty darned unusual to be requiring tabs.
> The other problem: When I use something like sendkeys and end > at the 12th tab, I don't get the source of that page. What I do
Oh, and that's the other thing. You should really be avoiding send keys, when at all possible. It is only a method of last resort, and it is really easy to mess up doing the kinds of things that you are doing (as you have come to realize). Without looking more at your specifics, my first inclination is to think that you have timing issues. One possiblility for you is to really slow the send keys down (if your architecture doesn't permit this, the timing issues become much more probable) so you can see it as it happens.
How do you avoid send keys? The answer is to fill out the form on the page (for example, something like: ie.document.getElementById("myId").value = "myEntry" or var body = ie.document.body body.getElementsByTagName("INPUT")(0).value = "myEntry") You can direct links and targets to a specific window by setting their target attribute to the name of the window or frame in question.
Oh, and yes, mayayana expressed both the principle of not using tabs nor using send keys much more succinctly in his Nov 8 post.
> get is the source of the very first page I need to start, with > credentials in order to have access to that particular site. Manually on > that page I can click on 'Source' in the menu and get the source I want...
> So no methodes to freely move between tabs and not getting the right source > dump....
> > 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?
> I've read this thread, and I don't see any justification for wanting > to put the pages in different tabs. Specifically, there is no mention > of user interaction. Assuming that there is no user involvement > and that you are simply after information on those pages, I think > you would be better off creating an IE instance for each page > to which you'd like to navigate. For example, an array of > IE instances which (eventually) should run hidden.
> However, there is a second problem, which is already evident > in your code, and that is that you are having a significant > problem determining when pages are ready. This is, in general, > quite a difficult issue. I think it would be far easier for you to > spawn a different process for each page you'd like to load so > that it can be dealt with separately. However, doing this > with 10 pages or so can be a massive hit on the CPU, so I > don't recommend this route.
> Parallel processing of pages is really messy. Unless you > have a REALLY SPECIFIC reason for needing the parallel > aspect, your posted code implies that you are doing > background processing. That being the case, you could > just as well process each page one at a time (which also > reduces the chance that the remote site will ban you for > robotic access of their pages). So you could have the > original IE for your starting page, and then create a > second IE for your array of links (so that you can get > back to your original IE when done with processing said > array). Now process each link one at a time (taking into > account what to do if you've gotten to some timeout limit > and the page hasn't loaded).
> Csaba Gabor from Vienna
> > 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
> > 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?
> By the way, I haven't tried this, and I don't have a tabbed IE here > to do so with, but if you click on the different tabs of IE, do you > get a different title in the title bar? If so, it's conceivable > (though > perhaps not likely) that you could activate a specific tab through > AppActivate. Has anyone tried that? I wouldn't want to take bets > on it, but...
I've done all, with and without tabs. And in both cases I can't get the "same" source of a page, manually vs vbscript.
So, for me, the problem is that vbscript can't do the job for me and I doubt another language can... I believe the problem is the internet.application-object does not provide the right "tools"
Btw: for my current job I automate every thing with vbscript and till now there was little I couldn't handle.... :-(
> Thank you for your message. I've already done what you described.
I've recommended two main things, and described a few things that I recommended against. The first recommendation was to stay away from tabs (using multiple instances or multiple invocations were two possible alternatives (but I certainly don't recommend either one)), especially by using single instance serial navigation.
The second was a possible way to get ahold of a tab (using AppActivate) if you nevertheless insist on tabs.
Which is it that you have already done?
> One Instance, two instances, 25 instances. But that's not the > problem.
> One of the problems is that it is not possible to go to the 12th tab > after creating 25 tabs (with ie VBScript).
You have not motivated the problem. What makes it compelling to create any tabs whatsoever? I'm not saying there couldn't be a reason, but without guiding our thinking a bit, it is hard to wrap our heads around why. Specifically, the internet world existed pretty well before tabs came along. They did so as a user convenience rather than a user necessity. So I would think you have to be doing something pretty darned unusual to be requiring tabs.
> The other problem: When I use something like sendkeys and end > at the 12th tab, I don't get the source of that page. What I do
Oh, and that's the other thing. You should really be avoiding send keys, when at all possible. It is only a method of last resort, and it is really easy to mess up doing the kinds of things that you are doing (as you have come to realize). Without looking more at your specifics, my first inclination is to think that you have timing issues. One possiblility for you is to really slow the send keys down (if your architecture doesn't permit this, the timing issues become much more probable) so you can see it as it happens.
How do you avoid send keys? The answer is to fill out the form on the page (for example, something like: ie.document.getElementById("myId").value = "myEntry" or var body = ie.document.body body.getElementsByTagName("INPUT")(0).value = "myEntry") You can direct links and targets to a specific window by setting their target attribute to the name of the window or frame in question.
Oh, and yes, mayayana expressed both the principle of not using tabs nor using send keys much more succinctly in his Nov 8 post.
> get is the source of the very first page I need to start, with > credentials in order to have access to that particular site. Manually on > that page I can click on 'Source' in the menu and get the source I want...
> So no methodes to freely move between tabs and not getting the right > source > dump....
> > 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?
> I've read this thread, and I don't see any justification for wanting > to put the pages in different tabs. Specifically, there is no mention > of user interaction. Assuming that there is no user involvement > and that you are simply after information on those pages, I think > you would be better off creating an IE instance for each page > to which you'd like to navigate. For example, an array of > IE instances which (eventually) should run hidden.
> However, there is a second problem, which is already evident > in your code, and that is that you are having a significant > problem determining when pages are ready. This is, in general, > quite a difficult issue. I think it would be far easier for you to > spawn a different process for each page you'd like to load so > that it can be dealt with separately. However, doing this > with 10 pages or so can be a massive hit on the CPU, so I > don't recommend this route.
> Parallel processing of pages is really messy. Unless you > have a REALLY SPECIFIC reason for needing the parallel > aspect, your posted code implies that you are doing > background processing. That being the case, you could > just as well process each page one at a time (which also > reduces the chance that the remote site will ban you for > robotic access of their pages). So you could have the > original IE for your starting page, and then create a > second IE for your array of links (so that you can get > back to your original IE when done with processing said > array). Now process each link one at a time (taking into > account what to do if you've gotten to some timeout limit > and the page hasn't loaded).
> Csaba Gabor from Vienna
> > 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
> > 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?
> By the way, I haven't tried this, and I don't have a tabbed IE here > to do so with, but if you click on the different tabs of IE, do you > get a different title in the title bar? If so, it's conceivable > (though > perhaps not likely) that you could activate a specific tab through > AppActivate. Has anyone tried that? I wouldn't want to take bets > on it, but...
On Nov 12, 10:47 pm, "AvWG" <dretr...@hotmail.com> wrote:
> Hi,
> I've done all, with and without tabs.
All -> what <- ? We seem to have a communication problem.
> And in both cases I can't get the "same" source of a > page, manually vs vbscript.
Well, I don't know how you are attempting to get the source of a page (indeed, I don't even know whether you have gotten ahold of the tabbed page, for that matter).
> So, for me, the problem is that vbscript can't do the job > for me and I doubt another language can... > I believe the problem is the internet.application-object > does not provide the right "tools"
Grousing and griping are fine, as far as I'm concerned, and I have done it on these groups myself. But without specifics, a person might be inclined to transform it in their mind like so: gripe -> grips -> grits -> writs -> write -> white -> whine
> Btw: for my current job I automate every thing with vbscript and till now > there was little I couldn't handle.... :-(
Then here's something else for your arsenal (tested on IE8): Set focus onto the link in the prior (active) page and then SendKeys "+^~"
> > Thank you for your message. I've already done what you described.
> I've recommended two main things, and described a few things that > I recommended against. The first recommendation was to stay > away from tabs (using multiple instances or multiple invocations were > two possible alternatives (but I certainly don't recommend either > one)), > especially by using single instance serial navigation.
> The second was a possible way to get ahold of a tab (using > AppActivate) if you nevertheless insist on tabs.
> Which is it that you have already done?
> > One Instance, two instances, 25 instances. But that's not the > > problem.
> > One of the problems is that it is not possible to go to the 12th tab > > after creating 25 tabs (with ie VBScript).
> You have not motivated the problem. What makes it compelling > to create any tabs whatsoever? I'm not saying there couldn't be > a reason, but without guiding our thinking a bit, it is hard to wrap > our heads around why. Specifically, the internet world existed > pretty well before tabs came along. They did so as a user > convenience rather than a user necessity. So I would think you > have to be doing something pretty darned unusual to be requiring > tabs.
> > The other problem: When I use something like sendkeys and end > > at the 12th tab, I don't get the source of that page. What I do
> Oh, and that's the other thing. You should really be avoiding > send keys, when at all possible. It is only a method of last resort, > and it is really easy to mess up doing the kinds of things that you > are doing (as you have come to realize). Without looking more > at your specifics, my first inclination is to think that you have > timing issues. One possiblility for you is to really slow the send > keys down (if your architecture doesn't permit this, the timing > issues become much more probable) so you can see it as it > happens.
> How do you avoid send keys? The answer is to fill out the > form on the page (for example, something like: > ie.document.getElementById("myId").value = "myEntry" > or > var body = ie.document.body > body.getElementsByTagName("INPUT")(0).value = "myEntry") > You can direct links and targets to a specific window by > setting their target attribute to the name of the window or > frame in question.
> Oh, and yes, mayayana expressed both the principle of > not using tabs nor using send keys much more > succinctly in his Nov 8 post.
> > get is the source of the very first page I need to start, with > > credentials in order to have access to that particular site. Manually on > > that page I can click on 'Source' in the menu and get the source I want...
> > So no methodes to freely move between tabs and not getting the right > > source > > dump....
> > > 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?
> > I've read this thread, and I don't see any justification for wanting > > to put the pages in different tabs. Specifically, there is no mention > > of user interaction. Assuming that there is no user involvement > > and that you are simply after information on those pages, I think > > you would be better off creating an IE instance for each page > > to which you'd like to navigate. For example, an array of > > IE instances which (eventually) should run hidden.
> > However, there is a second problem, which is already evident > > in your code, and that is that you are having a significant > > problem determining when pages are ready. This is, in general, > > quite a difficult issue. I think it would be far easier for you to > > spawn a different process for each page you'd like to load so > > that it can be dealt with separately. However, doing this > > with 10 pages or so can be a massive hit on the CPU, so I > > don't recommend this route.
> > Parallel processing of pages is really messy. Unless you > > have a REALLY SPECIFIC reason for needing the parallel > > aspect, your posted code implies that you are doing > > background processing. That being the case, you could > > just as well process each page one at a time (which also > > reduces the chance that the remote site will ban you for > > robotic access of their pages). So you could have the > > original IE for your starting page, and then create a > > second IE for your array of links (so that you can get > > back to your original IE when done with processing said > > array). Now process each link one at a time (taking into > > account what to do if you've gotten to some timeout limit > > and the page hasn't loaded).
> > Csaba Gabor from Vienna
> > > 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
> > > 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?
> > By the way, I haven't tried this, and I don't have a tabbed IE here > > to do so with, but if you click on the different tabs of IE, do you > > get a different title in the title bar? If so, it's conceivable > > (though > > perhaps not likely) that you could activate a specific tab through > > AppActivate. Has anyone tried that? I wouldn't want to take bets > > on it, but...- Hide quoted text -