Microsoft Windows Vista Community Forums - Vistaheads
Recommended Download



Welcome to the Microsoft Windows Vista Community Forums - Vistaheads, YOUR Largest Resource for Windows Vista related information.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so , join our community today!

If you have any problems with the registration process or your account login, please contact us.

Driver Scanner

IE8 and vbscript

microsoft.public.internetexplorer.general






Speedup My PC
Reply
  #1 (permalink)  
Old 11-08-2009
AvWG
 

Posts: n/a
IE8 and vbscript
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é


Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-08-2009
Robert Aldwinckle
 

Posts: n/a
Re: IE8 and vbscript

"AvWG" <dretrain@hotmail.com> wrote in message news:263af$4af6a406$5352a1ff$29878@cache4.tilbu1.n b.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
---


Reply With Quote
  #3 (permalink)  
Old 11-08-2009
AvWG
 

Posts: n/a
Re: IE8 and vbscript
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@techemail.com> schreef in bericht
news:e2hFCmHYKHA.4360@TK2MSFTNGP04.phx.gbl...
>
> "AvWG" <dretrain@hotmail.com> wrote in message
> news:263af$4af6a406$5352a1ff$29878@cache4.tilbu1.n b.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
> ---
>
>



Reply With Quote
  #4 (permalink)  
Old 11-08-2009
mayayana
 

Posts: n/a
Re: IE8 and vbscript
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@techemail.com> schreef in bericht
> news:e2hFCmHYKHA.4360@TK2MSFTNGP04.phx.gbl...
> >
> > "AvWG" <dretrain@hotmail.com> wrote in message
> > news:263af$4af6a406$5352a1ff$29878@cache4.tilbu1.n b.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
> > ---
> >
> >

>
>



Reply With Quote
  #5 (permalink)  
Old 11-08-2009
AvWG
 

Posts: n/a
Re: IE8 and vbscript
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@rcXXn.com> schreef in bericht
news:O1bvrIJYKHA.3504@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@techemail.com> schreef in bericht
>> news:e2hFCmHYKHA.4360@TK2MSFTNGP04.phx.gbl...
>> >
>> > "AvWG" <dretrain@hotmail.com> wrote in message
>> > news:263af$4af6a406$5352a1ff$29878@cache4.tilbu1.n b.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
>> > ---
>> >
>> >

>>
>>

>
>



Reply With Quote
  #6 (permalink)  
Old 11-08-2009
rob^_^
 

Posts: n/a
Re: IE8 and vbscript
Document.body.outerHTML returns the head block as well.

"AvWG" <dretrain@hotmail.com> wrote in message
news:263af$4af6a406$5352a1ff$29878@cache4.tilbu1.n b.home.nl...
> 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é
>
>

Reply With Quote
  #7 (permalink)  
Old 11-08-2009
AvWG
 

Posts: n/a
Re: IE8 and vbscript
Hi Rob,

This method is new to me. Have already tested it. It gives met HTML code but
not of the page I want...

Still thanks,

André

"rob^_^" <iecustomizer@hotmail.com> schreef in bericht
news:eUGwKXKYKHA.4452@TK2MSFTNGP04.phx.gbl...
> Document.body.outerHTML returns the head block as well.
>
> "AvWG" <dretrain@hotmail.com> wrote in message
> news:263af$4af6a406$5352a1ff$29878@cache4.tilbu1.n b.home.nl...
>> 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é
>>
>>



Reply With Quote
  #8 (permalink)  
Old 11-09-2009
Robert Aldwinckle
 

Posts: n/a
Re: IE8 and vbscript

"AvWG" <dretrain@hotmail.com> wrote in message news:7bebb$4af6eb13$5352a1ff$12218@cache1.tilbu1.n b.home.nl...
> Hi Robert,
>
> Thank you for your quick response.
>
> 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.


Robert
---


Reply With Quote
  #9 (permalink)  
Old 11-09-2009
mr_unreliable
 

Posts: n/a
Re: IE8 and vbscript
AvWG wrote:
> 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....
>


hi AvWG,

Unless you are using microsoft's tab control (with its own
methods and properties), then you will have to "roll-yer-own"
tab control. There are several examples of how to do this
via html/dhtml posted on the web. Lets say you decide to
implement your own tab control using a series of (html) buttons.
In that case, you can select the tab you want using a
button.click statement.

I have attached a script which shows a row of "made-up" tabs,
which is just a row of buttons. The trick here is in how you
"decorate" the buttons. I found the underlying tab control code
on the web, but can't remember where I found it (sorry if the
real author is lurking out there). Anyway, if you decide to do
something like this, you can see what it would take to "click-
a-tab".

Beyond that, if you just want to open a series of webpages
one-at-a-time, then I agree with mayayana -- you don't need
any tabs to do that...

cheers, jw
__________________________________________________ __________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)

p.s. Achtung Vorsicht! If you decide to try out the attached
script (er, I mean hta) then you will discover that it is not
fully debugged, and was only taken to the "proof-of-concept"
point. If you dismiss the error dialogs, you should get a
working "tab control". Also, don't get too annoyed with the
comments promising to show a "fake status bar" -- that isn't
there. I used another script as a template but didn't clean
up the comments. Sorry about that.

Note also, the extensions of the "hta" file and the accompanying
"css" file were changed to "txt", to avoid having any nasty AV
software from screening them out as "malicious" scripts.

<HTML>
<HEAD>

<script language="vbscript">
' --- discussion (avoiding that annoying hta "dialog bounce") ---
' this "trick" found on the vbScript ng, code by mikHar, 05Sept06
' Normally, an hta dialog will initially be shown in its "default"
' position and size for a brief instant. Later, when it gets
' around to running your script code, it will move/resize itself
' according to your wishes. Placing the move/resize code AHEAD
' of the hta tag seems to avoid that...
' --- end of discussion ----------------------

Const wdDlg = 600, htDlg = 380 ' dialog size
Const pxLeft = 100, pxTop = 100 ' positioning
window.ResizeTo wdDlg,htDlg
window.MoveTo pxLeft,pxTop
</script>

<HTA:APPLICATION ID="oHTA" APPLICATIONNAME="htaDebugDialogTemplate"
WINDOWSTATE="normal" SCROLL = "no" BORDERSTYLE="normal" BORDER="thin"
CAPTION="yes" MAXIMIZEBUTTON="no" MINIMIZEBUTTON="no" ICON="mru.ico"
SHOWINTASKBAR="yes" SINGLEINSTANCE="yes" SYSMENU="yes" VERSION="1.0" >

<TITLE> &nbsp;&nbsp; &lt&lt (hta) Debug Dialog Template (with Fake StatusBar) Demo Script &gt&gt </TITLE>
<!-- bring in stylesheet for the "tab control buttons" -->
<link rel="stylesheet" type="text/css" href="tabStyles.css">

<SCRIPT LANGUAGE="vbScript">
<!--

' --- description block --------------------------
'
' Title: (hta) debug dialog with Fake StatusBar, jw 12May06
'
' Description: A scripting graphical user interface (gui),
' appropriate for posting debugging messages or status msgs.
' Due to difficulties with posting messages to microsoft's
' IE statusbar, there is also a "fake" statusbar included...
'
' Author: mr_unreliable
' Website: none at this time (but lurks around the wsh/vbs ng's)
'
' Usage: Use at you own risk, tested on win98se...
'
' --- revision history ---------------------------
' 12May06: initial attempt (working from "regular" hta dbDlg)...
' 13May06: added "working clock"...
' 20May06: added "scroll into view" option for scrolling...
' 05Dec07: NOTA BENE: this script needs "tabStyles.css" in the same sub-directory...
' --- end of description block -------------------

Option Explicit

' --- global variables ---------------------------
'
' Dim oFSO : Set oFSO = CreateObject("Scripting.FileSystemObject")
' Dim oShell : Set oShell = CreateObject("WScript.Shell")
'
Dim oDoc ' as document object
Dim clkTmr ' as timer (used to update clock)
Const clkTmrInt = 995 ' clock update interval (note: LESS THAN 1 SEC)
'
Dim tRun ' as long (to keep track of running time)
Dim iItem ' as integer (to keep track of "span" tags)
Dim iMsg ' as integer (sequential number, to keep track of messages)
Const bAlignWithTop = True
Const bAlignWithBottom = False
' --- end of declarations and constants ----------




' --- INITIALIZATION ROUTINE ---------------------

Sub initDialog()
Const sMe = "[initDialog], "

' do a little adjusting of my size and location...
' window.ResizeTo wdDlg,htDlg
' window.MoveTo 100,100
Set oDoc = window.document

Call tabLoad()

With oDoc
' resize text area...
oDoc.getElementById("msgList").style.width = wdDlg - 25
' htClientArea, less statusbar, logo, less button, less progbar, less...
oDoc.getElementById("msgList").style.height = oDoc.body.clientHeight _
- 25 - 20 - 35 - 20 ' (and less fudge factor, but don't tell anybody)...

' MsgBox("Client Width: " & oDoc.body.clientWidth _
' & "Client Height: " & oDoc.body.clientHeight)

' re-position the logo to lie just above the (fake) statusbar...
oDoc.getElementById("logo").style.top = oDoc.body.clientHeight - 47
oDoc.getElementById("logo").style.left = oDoc.body.clientWidth - 215

' re-position the (fake) statusbar at the bottom of the form (er, dialog)...
oDoc.getElementById("etchedEdge").style.top = oDoc.body.clientHeight - 25
oDoc.getElementById("fakeStatusBarFrame").style.to p = oDoc.body.clientHeight - 23


' oDoc.getElementById("btnExit").disabled = False
oDoc.getElementById("btnExit").onClick = GetRef("btnExit_Click")
End With

' place a message in the main statusbar panel...
oDoc.getElementByID("statusPanel1").innerText = " The ""Main"" statusbar panel text goes here "

' place the current time in the clock panel of the statusbar...
oDoc.getElementByID("statusPanel2").innerText = " Time: " _
& formatDateTime(Time, vbLongTime)

' set clock timer, (used to update the clock)...
ClearInterval(clkTmr) : clkTmr = setInterval("clkTimer_Event", clkTmrInt, "vbscript")

tRun = 0 ' initialize the running time...
iItem = 0

dbPrint sMe & "finished.. "

' hiding the dbMsgs, for now...
oDoc.getElementByID("msgLabel").style.visibility = "hidden"
oDoc.getElementByID("msgList").style.visibility = "hidden"

msgBox("pause2")

End Sub


' --- SIMULATE DEBUG.PRINT -----------------------

Sub dbPrint(sMsg) ' simulates debug.print...
Dim msgID ' as string

' posting messages and scrolling down (take II)...
' In this version, the posted messages are "wrapped" into "span tags",
' and given an "id" attribute containing the "message number",
' then inserted into the listing...
msgID = "msg" & CStr(iMsg)
oDoc.getElementById("msgList").insertAdjacentHTML "BeforeEnd", _
"<span id=""" & msgID & """ >" & sMsg & "<br></span>"

' and the current/last span tag (message) is scrolled into view...
oDoc.getElementByID(msgID).scrollIntoView(bAlignWi thBottom)

' also, publish the current dbMessage in the (fake) statusbar panel...
oDoc.getElementByID("statusPanel1").innerText = " " & sMsg

iMsg = iMsg + 1 ' bump up for next message
End Sub

Sub old2_dbPrint(sMsg) ' simulates debug.print...
Dim colSPANs ' as collection
Dim msgID ' as string

With oDoc ' saves a little typing...

' posting messages and scrolling down (take II)...
' In this version, the posted messages are "wrapped" into "span tags"
msgID = "msg" & CStr(iMsg)
.getElementById("msgList").insertAdjacentHTML "BeforeEnd", _
"<span id=""" & msgID & """ >" & sMsg & "<br></span>" ' add message to listing

' find all the span tags, and gather into a collection...
' Set colSPANs = .getElementsByTagName("span")
' and the last span tag (message) is scrolled into view...
' colSPANs(colSPANs.Length - 1).scrollIntoView(bAlignWithBottom)

.getElementByID(msgID).scrollIntoView(bAlignWithBo ttom)

iMsg = iMsg + 1 ' bump up for next message

End With ' oList
End Sub

Sub old1_dbPrint(sMsg) ' simulates debug.print...
Dim colSPANs ' as collection
Dim cMsgs ' as integer (msg count)

With oDoc ' saves a little typing...

' .insertAdjacentText "BeforeEnd", sMsg & vbCrLf ' add message to listing
' ok, so paging down is unsophisticated and overkill,
' but the lesser (scrolling) increments don't seem to work for me.
' If you know the "right way" to do this, then kindly let me know...
' (and yes, I do realize that you don't need any scrolling for the
' first seven or so entries, you can add that code for yourself)...
' .doScroll("pageDown")

' posting messages and scrolling down (take II)...
' In this version, the posted messages are "wrapped" into "span tags",
' and the span tag is "scroll(ed)IntoView"...
.getElementById("msgList").insertAdjacentHTML "BeforeEnd", "<span>" & sMsg & "<br></span>" ' add message to listing
' .all.Tags("span")(iItem).scrollIntoView(bAlignWith Bottom)
' .getElementsByTagName("span")(iItem).scrollIntoVie w(bAlignWithBottom)
' Set colSPANs = .getElementsByTagName("span")
' cMsgs = colSPANs.Length
' colSPANs(cMsgs - 1).scrollIntoView(bAlignWithBottom)
' cMsgs = colSPANs.Length

' scroll "last message" into view...
Set colSPANs = .getElementsByTagName("span")
colSPANs(colSPANs.Length - 1).scrollIntoView(bAlignWithBottom)

iItem = iItem + 1 ' bump up for next item

End With ' oList
End Sub



' ------------------------------------------------
' --- EVENT HANDLERS -----------------------------
' ------------------------------------------------

Sub clkTimer_Event() ' update the clock
Const sMe = "[timer], "

' msgbox("timer event detected")
oDoc.getElementByID("statusPanel2").innerText = " Time: " _
& formatDateTime(Time, vbLongTime)

' every to often, post a debug message, just for the entertainment value...
tRun = tRun + 1
' if ((tRun mod 10) = 0) then dbPrint sMe & "elapsed time: " & CStr(tRun) & " secs"
dbPrint sMe & "elapsed time: " & CStr(tRun) & " secs"
End Sub


Sub btnExit_Click()
Const sMe = "[btnClick], "
' MsgBox("detected Click Event")
ClearInterval(clkTmr) ' stop the clock timer

' post a notification to the debug window...
dbPrint "" ' space
dbPrint sMe & " ..detected Exit Button Click Event "
dbPrint sMe & " (this window will close in 1 sec) "

' wait-a-bit, to allow for reading the msg,
' by setting ANOTHER timer, to close this dialog window...
SetTimeout "Window.Close", 1000

End Sub


Sub CleanUp()

' msgbox("onUnload event detected")
ClearInterval(clkTmr)
End Sub
//-->
</SCRIPT>


<SCRIPT LANGUAGE="vbScript" TITLE="Setup Tab Controls" >
<!--

' --- execute NOW (gloal variables) --------------
Const tabAlign = "Left"
Dim saURLs : saURLs = Array("MSDN|http://msdn.microsoft.com", _
"CNN|http://www.cnn.com", _
"NASA|http://www.nasa.gov", _
"Google|http://www.google.com|*", _
"Forbes|http://www.forbes.com")
Dim cTabs : cTabs = UBound(saURLs)
' --- end of global variables --------------------


Sub tabLoad()
Dim sHTML : sHTML = "<P ALIGN=" & tabAlign & ">&nbsp;&nbsp;"
Dim i ' as integer
Dim saTAB ' as string array

' add onMouseOver, onMouseOut...
For i = 0 to cTabs ' create button control(s)
saTAB = Split(saURLs(i),"|")
' msgBox(saTAB(0) & saTAB(1))
sHTML = sHTML & "<BUTTON ID=tab" & CStr(i) _
& " CLASS='tabOff' VALUE=" & saTAB(1) _
& " onClick='tabOnClick(" & CStr(i) & ")'>" _
& saTab(0) & "</BUTTON>"
' if (i = 0) then msgbox(sHTML)
Next ' i

divTabButtons.innerHTML = sHTML ' insert tab buttons into first div

Call tabOnClick(3) ' set the 4th tab as default...

MsgBox("pause")

End Sub ' tabLoad

Sub tabOnClick(iTab)

Dim oElement ' as object
Dim i ' as integer

For i = 0 to cTabs ' set ALL tabs to "taboff" style...
' msgbox(i)
Set oElement = document.getElementById("tab" & CStr(i))
oElement.className = "tabOff"
Next ' i

' then, highlight the selected tab...
Set oElement = document.getElementById("tab" & CStr(iTab))
oElement.className = "tabOn"

' and setup the appropriate contents of the "tab" (i.e., iframe it)...
' var tab = tabs[ID].split("|");
divTabFrame.innerHTML = "<IFRAME SRC='about:blank' CLASS='tabFrame'></IFRAME>"

' to avoid drawing the "focus rectangle" around the tab button...
document.body.focus()
End Sub ' tabOnClick

//-->
</SCRIPT>


<style>
body {font-family: ms sans serif; font-size: 10pt; font-weight: 400; color: Navy;
margin-top: 4px; margin-left: 1px; margin-right: 1px; margin-bottom: 1px;
height: 10px; width: 10px; border-style: none; }
div.listBox {border-style: inset; border-width: 2; background-color:aliceblue;
overflow:auto; text-align:left;
font-family:verdana; font-size:10pt; font-weight:400; color:Navy; }
textarea {font-family: verdana; font-size: 10pt; font-weight: 400; color: Navy; }
button {margin-top: 7px; height: 25px; width: 100px; font-family: verdana; font-weight: 600;
width: 125px; }

h3 {margin-top: 3px; margin-bottom: 2px; padding-top: 0%; padding-bottom: 0%;
font-family: verdana; font-size: 8pt; font-weight: 400; color: Navy; }
h4 {position:absolute; top:100; left: 2;
margin-top: 6px; margin-bottom: 0px; padding-top: 0%; padding-bottom: 0%;
font-family: Arial; font-size: 8pt; font-weight: Normal; font-style: Italic;
color: Navy; }

hr {position:absolute; top:100; left: 2; margin-top: 1px; margin-bottom: 1px; }
table {position:absolute; top:110; left: 1; margin-top: 1px; margin-bottom: 1px;
border-style: none; border-width: 1; width: 100%; height: 20px; }
td {border-style: inset; border-width: 2;
font-family: verdana; font-size: 8pt; font-weight: normal; color: Navy }
</style>
</HEAD>

<!-- this is the "mother" (a.k.a. "debug dialog") page -->
<BODY onload="initDialog()" onUnload="CleanUp()" scroll='no' text='navy' bgcolor="silver" >

<DIV ID="divTabButtons"></DIV>
<CENTER>
<DIV ID="divTabFrame">



<h3 id="msgLabel" >&nbsp;&nbsp;debugging messages... </h3>
<CENTER>
<!-- using "div" element (instead of textarea) for posting messages,
instead of a listbox (i.e., what you would have used in vb)... -->
<DIV id="msgList" class="listBox">
</CENTER>
</DIV>

<BUTTON id="btnExit" onclick="window.close()" >Exit</BUTTON>
</CENTER>

<h4 id="logo" ALIGN=RIGHT >&nbsp;jawar productions (all rights reserved)... </h4>

<!-- using table as (fake) statusbar. (with "inset" border) -->
<hr id="etchedEdge" width=99% align=center >
<TABLE id="fakeStatusBarFrame" width=99% bgcolor=silver align=center ><TR>
<TD id="statusPanel1" bgcolor=silver >&nbsp;
<TD id="statusPanel2" style="width: 120px; ">&nbsp; Time 12:00:00 </TR></TABLE>

</BODY>
</HTML><style type="text/css">
<!--

.tabOff { WIDTH: 90; HEIGHT: 20;
FONT-FAMILY: Verdana;
FONT-SIZE: 10;
FONT-WEIGHT: 700;
TEXT-ALIGN: CENTER;
COLOR: Navy;
BACKGROUND-COLOR: LightSteelBlue;
BORDER-BOTTOM: LightSteelBlue 1PX SOLID;
CURSOR: HAND;
}

.tabOn { WIDTH: 90; HEIGHT: 23;
FONT-FAMILY: Verdana;
FONT-SIZE: 10;
FONT-WEIGHT: 700;
TEXT-ALIGN: CENTER;
COLOR: White;
BACKGROUND-COLOR: LightSlateGray;
BORDER-BOTTOM: LightSlateGray 1PX SOLID;
BORDER-TOP: DarkOrange 2px SOLID;
CURSOR: HAND;
}

.tabFrame {
ORDER: 0;
HEIGHT: 50%;
WIDTH: 99%;
COLOR: Black;
BORDER-TOP: LightSlateGray 3px SOLID;
BORDER-BOTTOM: LightSlateGray 3px SOLID;
BORDER-LEFT: LightSlateGray 3px SOLID;
BORDER-RIGHT: LightSlateGray 3px SOLID;
SCROLLBAR-FACE-COLOR:#6699CC;
SCROLLBAR-HIGHLIGHT-COLOR:#FFFFFF;
SCROLLBAR-SHADOW-COLOR:#6699CC;
SCROLLBAR-ARROW-COLOR:#FFFFFF;
SCROLLBAR-DARKSHADOW-COLOR:#6699CC;
}

// -->
</style>


Reply With Quote
  #10 (permalink)  
Old 11-09-2009
AvWG
 

Posts: n/a
Re: IE8 and vbscript
Hi Robert,

Yes I used a waitfor... and yes I will look outside this Group

Tnx for your explanation, very clear!

André

"Robert Aldwinckle" <robald@techemail.com> schreef in bericht
news:eSo3o5UYKHA.4688@TK2MSFTNGP06.phx.gbl...
>
> "AvWG" <dretrain@hotmail.com> wrote in message
> news:7bebb$4af6eb13$5352a1ff$12218@cache1.tilbu1.n b.home.nl...
>> Hi Robert,
>>
>> Thank you for your quick response.
>>
>> 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.
>
>
> Robert
> ---
>
>



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
VBScript Dagmar microsoft.public.de.windows.vista.sonstiges 11 09-16-2009 13:47
Deobfuscating VBScript, (Mon, Sep 3rd) Steve Security News 0 09-03-2007 01:41
VBScript run time ? Messagerie Wanadoo microsoft.public.fr.windows.vista.general 1 08-20-2007 17:47
Fonction VBScript ProgiCL microsoft.public.fr.windows.vista.programmation 2 04-18-2007 12:46
Vbscript ! J. K. microsoft.public.fr.windows.vista.installation 3 04-08-2007 21:57




All times are GMT +1. The time now is 12:27.




Driver Scanner - Free Scan Now

Vistaheads.com is part of the Heads Network. See also XPHeads.com , Win7Heads.com and Win8Heads.com.


Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.0 RC 2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120