[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Scheduled task to launch a browser window with a URL if its not already running.

Posted on 2011-04-29
3
Medium Priority
?
158 Views
Last Modified: 2013-11-19
Hello Experts,

I have this requirement of a particular web page to be running all the time in Windows.
I can write a scheduled task with START "" "URL" to instantiate it.

How can I check if the browser with the URL is already running?
If not, onloy then call START "" "URL". This mechanism needs to be incorporated in my scheduled task.

Regards.
0
Comment
Question by:fantasylan
1 Comment
 
LVL 7

Accepted Solution

by:
CitizenRon earned 2000 total points
ID: 35497303
Here's some code to check the "Shell.Application" object for instances of a particular ".locationURL", in this case Google.  If it does find it running, it simply alerts the user with a MsgBox and if it is not running, it launches Google using hte InternetExplorer.Application's Navigate method.

Set objShell = CreateObject("Shell.Application")
Set objIE = CreateObject("InternetExplorer.Application")

strWebPageURL = "http://www.google.com/"

For Each objWindow In objShell.Windows()
	If objWindow.locationUrl = strWebPageURL Then 
		WebPageIsRunning = True
	End If
Next

If WebPageIsRunning Then
	MsgBox strWebPageURL & " is already running"
Else
	objIE.Navigate strWebPageURL
	objIE.Visible = 1
End If

Open in new window


It may need some modification for your needs based on the exact URL of your particular webpage.  The strWebPageURL should be the EXACT address as shown in the IE address bar.  If the URL has some part of it that varies, that will also need to be taken care of with some extra code.  
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

834 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