Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For loop Help

Status
Not open for further replies.

gph1

Technical User
May 19, 2002
73
CA
This checks for a particular web opened in FrontPage. It works but I would like to know how to do the loop in VBScript.

Could someone please show me an example of a For loop using the count and Url properties?

<html>
<head>
<title>Check FP Status</title>
<script language=&quot;VBScript&quot;>

Sub HowManyWebsOpen()
Dim objFP,Object
Set objFP = CreateObject(&quot;FrontPage.Application&quot;)
NumberOfWebsOpen = objFP.Webs.count
Set objFP = Nothing
End Sub

Sub WebURLs(number)
Dim objFP,Object
Set objFP = CreateObject(&quot;FrontPage.Application&quot;)
WebURL = objFP.Webs(number).Url
Set objFP = Nothing
End Sub

</script>
<script type=&quot;text/javascript&quot;>

NumberOfWebsOpen = 0
WebURL = '';
Path = 'C:\\folder'

function CheckForFPOpenToWeb() {
FpOpen = false
HowManyWebsOpen()
for (var i=0;i<NumberOfWebsOpen;i++) {
WebURLs(i)
Local_Path = WebURL.replace(/\//g,&quot;\\&quot;).slice(8,WebURL.length)
if (Path == Local_Path) {
FpOpen = true
}
}
if (FpOpen) {
alert('open')
} else {
alert('closed')
}
}

</script>
</head>
<body>
<input type=&quot;button&quot; value=&quot;Check&quot; onclick=&quot;CheckForFPOpenToWeb()&quot;>
</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top