header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

[August 25th, 2008] Check the home page regarding PowerShell related news from a brand new sponsor: Idera

wait for internet explorer to exit before next pass
Last Post 07 Feb 2008 09:45 PM by kctalbot. 4 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
kctalbotUser is Offline
New Member
New Member
Posts:14
Avatar

--
06 Feb 2008 04:47 PM  

I am not asking the right question of google.  I have 500 URLs that I need to examine.  How get I use my foreach loop to load one URL into ie and then wait for me to close ie before opening up the next instance?  I swear I saw something like this with either Internet Explorer or Excel and now can't locate a how to.

Kct

marco.shawUser is Offline
Co-Community Director
Basic Member
Basic Member
Posts:188
Avatar

--
06 Feb 2008 05:42 PM  
You're calling IE to open up these sites one at a time? IE7? You could maybe load quicker if you try to load a web site to different tabs... What do you have so far as for a script?
Marco

*Microsoft MVP - Windows PowerShell: http://www.microsoft.com/mvp
*PowerGadgets MVP: http://www.powergadgets.com/mvp
*Blog: http://marcoshaw.blogspot.com
kctalbotUser is Offline
New Member
New Member
Posts:14
Avatar

--
07 Feb 2008 01:21 PM  

My mind is apparently taking a snow day.  Data and my notes are sitting an hour and a half away, I cleaned up my desktop yesterday and then left a nice pile of organized stuff sitting at home.

I've been trying to pull this together interactively, haven't put a script together, but I will have to do this again in the future, so I have kept track of what code worked. 

I had pulled out all the teamsite URLs into a text file, about 400 sites.  Then it is

$sites = get-childitem d:\temp\teamsites.txt
foreach ($site in $sites)
{ $ie = new-object -comobject "InternetExplorer.Application"
  $ie.visible = $true
   $ie.navigate($site)
}

Then the windows popped up everywhere.  I need to review each site, make several changes on most of them and then move on to next site.  If I can do this one at a time, I can document where I left off and then start up again later.  400 open sites and I will still skipping through randomly.

IE6 in production.  I had thought of read-host and wait for enter, but then have been chasing what I thought I remembered as a better idea.

kct

kscrissUser is Offline
Basic Member
Basic Member
Posts:119

--
07 Feb 2008 03:42 PM  
Maybe you could slow down your FOREACH loop with a command like this:

$Continue= Read-host "Next one (yes or no)"
Then you could test $Continue and perhaps note a check-off somehow on the one you just completed.
My blog: http://blogs.powershellcentral.com/kscriss/
kctalbotUser is Offline
New Member
New Member
Posts:14
Avatar

--
07 Feb 2008 09:45 PM  

Get-Content allsites.txt | where-object {$_ -match "kct_teamsite" -and $_ -match "kct/sites" } > teamsites.txt
get-content teamsites.txt | foreach-object {
 $locURL = $_.indexof(' Url="http://')
 $locOwner = $_.indexof(" Owner=")
 $EndStr = $locOwner - $locURL
 $TeamURL = $_.substring($locURL,$EndStr)
 $TeamURL = $TeamURL -Replace ' Url="http://',''
 $TeamURL = $TeamURL -Replace '"',''
 $ie = new-object -comobject "InternetExplorer.Application"
 $ie.visible = $true
 $ie.navigate("$TeamURL")
 Read-Host "Enter to continue"
 }

I am getting the process working, to the point I get web page, minimized.  Switch to page, make updates, close page, and go back to PowerShell and hit enter for next go around.  From deafening silence I've got to assume what I thought I read was not related to having PowerShell wait for the IE close event before continuing.  If there is a more elegant way of doing this, please let me know.

I did have some problems that I don't understand.  I started off leaving the double quotes around the URL to preserve the blanks.  What happened was the site would open as http://%22mysite/kct" and I would get site not found.  Eliminating the quotes took care of the problem, but why did my leading quote get replaced by %22 and yet the trailing quote did not.  It still does not work if I type it in, but at least both quotes are converted to %22.

IE doesn't open on top.  Is there something in the framework that would move window to foreground?

Is there a way to start IE with a runas?  I needed to bump permissions and was able to work around the issue by starting up IE manually with admin account and then all the new windows opened with the same permission.  It just seems like a cleaner approach to have everything in the script.

Thanks for help and leading questions.

kct

You are not authorized to post a reply.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • ShellTools, LLC • Microsoft Windows Server 2008 footer
footer