Solved

Focusing on a WScript IE explorer window

Posted on 2003-11-11
8
797 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

743 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

12 Experts available now in Live!

Get 1:1 Help Now