Solved

Focusing on a WScript IE explorer window

Posted on 2003-11-11
8
798 Views
Last Modified: 2012-05-04
I'm not very familiar with VBScript, in fact this is my first day dealing with it. I'm basing most of the script off of an earlier version.   Basically all the program does is open an IE window (via WScript) load the HTML, then send the information from the form to a perl script.  That is all working fine, but I can't get the Script to focus on the IE window, so it opens behind everything else.  I've looked all over the place and can't seem to find anything that will help, so I am giving in and asking people.

The code I have involving the window is

dim oIE

set oIE = WScript.CreateObject("InternetExplorer.Application", IE_)
//
|| Code defining the window size, etc
\\
oIE.navigate pathe & "LMP_Form.htm"
oIE.visible = 1



0
Comment
Question by:trunks2k
8 Comments
 

Accepted Solution

by:
alibabas earned 25 total points
ID: 9725358
Try the following code... or at least part of it.. you can tweak as you like.

'code start
Dim IE
Set IE = CreateObject("InternetExplorer.Application")
IE.navigate "www.google.com
IE.visible=1 ' ignore this line if you dont want the browser to be visible  
' let the page load
Do while IE.busy
loop
Do While UCase(IE.Document.readyState) <> "COMPLETE"
     WScript.Sleep 100
   DoEvents
Loop
'now close ie
IE.Quit
set IE=nothing
'code ends
0
 
LVL 5

Assisted Solution

by:fantasy1001
fantasy1001 earned 25 total points
ID: 9727242
Do you want a perl solution for this? I mean we can grab the content of the site in html in perl directly.

~ fantasy ~
0
 

Author Comment

by:trunks2k
ID: 9732199
alibabas:

That's pretty much what is there already.

fantasy1001:

sure, I'll take a perl solution.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Expert Comment

by:alibabas
ID: 9732583
Fantasy,

I don't know why you have the IE open up in the background... I used the smae code adn got it to come up in front/top off all my other screens..  I commented out the ie.quit and set to nothing..and it stays to the top.

also.. not sure if you have gone to the following page.. but check it out.. it might help.

http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/objects/internetexplorer.asp

Good luck.
0
 
LVL 5

Expert Comment

by:fantasy1001
ID: 9735981
This example show you how to grab a html content using perl:

#!/bin/perl
use LWP::Simple;
use HTML::Parse;
     
    print (get $ARGV[O]);    # use this if you want html format of text
    print parse_html(get ($ARGV[0]))->format;      # use this if you want all the tag stripped out
 
you can run the script by passing an url to it like this

%>> perl myscript.pl www.google.com

~ fantasy ~
 
 

0
 
LVL 49

Expert Comment

by:DanRollins
ID: 10537208
Moderator, my recommended disposition is:

    Split points between: alibabas and fantasy1001

Dan Rollins -- EE database cleanup volunteer
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Help in WHSCRIPT 9 47
Paint/Redraw window while dragging 16 68
How does CurrentUser work? 10 31
Prevent checkbox click event occur while editing it in vb6 8 35
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now