Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Active Window

46 views
Skip to first unread message

scott

unread,
Feb 28, 2005, 1:01:41 PM2/28/05
to
Below code opens a html pop-up. It opens fine when my .vbs file is
double-clicked except it is minimized. How can I make it the active window?


Function RenderHTML(myMessage)
Dim objIExplorer
Dim objFileSystem
Dim objDocument
Dim objWMIService
Dim colServices
Dim objService
Dim strComputer

Set objIExplorer = CreateObject("InternetExplorer.Application")
Set objFileSystem = CreateObject("Scripting.FileSystemObject")

objIExplorer.Navigate "about:blank"
objIExplorer.AddressBar = 0
objIExplorer.Height = 400
objIExplorer.Width = 580
objIExplorer.MenuBar = 0
objIExplorer.StatusBar = 0
objIExplorer.ToolBar = 0
objIExplorer.Left = 50
objIExplorer.Top = 50
objIExplorer.Visible = 1

Do While (objIExplorer.Busy)
Wscript.Sleep 250
Loop

Set objDocument = objIExplorer.Document
objDocument.Open
objDocument.Writeln "<html><head><title>Backup</title></head>"
objDocument.Writeln "<body bgcolor='ffffff'>"
objDocument.Writeln myMessage
objDocument.Writeln "</body></html>"
objDocument.Write()
objDocument.Close
End Function


Csaba2000

unread,
Feb 28, 2005, 2:37:46 PM2/28/05
to
function newIEtoForeground(title, evtPrefix)
'pass in null for evtPrefix if we're not sinking events
if isNull(evtPrefix) Then Set
ie=CreateObject("InternetExplorer.Application") _
Else Set ie = CreateObject("InternetExplorer.Application", evtPrefix)
ie.Navigate("about:blank") 'so we get access to ie.Document
Do Until ie.ReadyState=4 : Wscript.Sleep 10 : Loop

'Make window adjustments here (examples follow)
ie.Document.ParentWindow.opener="me" 'allows self.close()
ie.Document.ParentWindow.resizeTo 600,400 'size
ie.toolbar = false 'appearance

'This section brings the new ie to the foreground
Randomize: myRand = Rnd()
ie.Document.title = myRand 'a unique title
ie.Visible = true 'must be visible for AppActivate
With CreateObject("WScript.Shell")
Do until .AppActivate(myRand & " - M") : Wscript.Sleep 10: Loop
End With

ie.Document.title = title
set newIEtoForeground = ie
End Function


Csaba Gabor from Vienna


scott

unread,
Feb 28, 2005, 7:34:56 PM2/28/05
to
How would I use your code with my function in my original post? I'm
confused.


"Csaba2000" <cs...@z6.com> wrote in message
news:ut3c1zcH...@TK2MSFTNGP09.phx.gbl...

Csaba2000

unread,
Feb 28, 2005, 8:54:10 PM2/28/05
to
' Set objIExplorer = CreateObject("InternetExplorer.Application")
Set objIExplorer = newIEtoForeground("Whatever", null)

' objDocument.Writeln "<html><head><title>Backup</title></head>"


' objDocument.Writeln "<body bgcolor='ffffff'>"
' objDocument.Writeln myMessage
' objDocument.Writeln "</body></html>"
' objDocument.Write()

newDoc = "<html><head><title>Backup</title></head>" & _
"<body bgcolor='ffffcc'>" & myMessage & _
"</body></html>"
objDocument.Write (newDoc)

Note that the first if statement in newIEtoForeground, below,
got wrapped. The if should be on one line and the Else on the
next line.
Csaba


"scott" <sba...@mileslumber.com> wrote in message
news:u0rVFdfH...@tk2msftngp13.phx.gbl...

scott

unread,
Mar 1, 2005, 11:10:59 AM3/1/05
to
Going by my 1st function, is it possible to open the pop-up window, then do
certain tasks, then write the results back to the open pop-up?

Do you have any sample code or links?

"Csaba2000" <cs...@z6.com> wrote in message

news:OhGRRGgH...@TK2MSFTNGP09.phx.gbl...

Torgeir Bakken (MVP)

unread,
Mar 1, 2005, 12:21:01 PM3/1/05
to
scott wrote:

> Going by my 1st function, is it possible to open the pop-up window, then do
> certain tasks, then write the results back to the open pop-up?
>
> Do you have any sample code or links?

Hi

An example on using an Internet Explorer window where you can
dynamically put out information about what is going on:

http://groups.google.co.uk/groups?selm=3EA302E5.5BAE90EB%40hydro.com

If you want a scrolling window (keeping the messages already displayed),
try this script (this is what I use in our logon script):

http://groups.google.co.uk/groups?selm=400F20F1.AD140C21%40hydro.com


In case people has used the search bar in IE in their previous logon
session, you should turn it off before opening IE, setting the
ShowBrowserBar property before you call the SetupMSIE sub, like the
code in this post:

http://groups.google.co.uk/groups?selm=40326016.D28ABB5B%40hydro.com

--
torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
Administration scripting examples and an ONLINE version of
the 1328 page Scripting Guide:
http://www.microsoft.com/technet/scriptcenter/default.mspx

0 new messages