Advertisement

08.19.2004 at 07:42AM PDT, ID: 21099829
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

how to make a vbscript sleep w/o pinning the cpu

Tags: sleep, vbscript
I am trying to make a client-side vbscript sleep but can't do it w/o pinning the cpu

The Code is below, pretty straight forward, but I get the following error:

error: object doesn't support this property or method 'Wscript.Sleep'

***********code
<html>
<head>
<SCRIPT LANGUAGE="vbscript" >
      function bSleep()
            document.All.whatsup.innerHTML = "I'm sleepy"
            Set WScript = CreateObject("WScript.Shell")
            WScript.Sleep 2000
            document.All.whatsup.innerHTML = "Done sleeping"
      end function
</script>
<body onload="call bSleep()">
<div id="whatsup"></div>
</body>
</html>

***********end code

To workaround, I swap out the wscript.sleep and use a loop, but it pins the cpu and that isn't acceptable because I am sleeping so other stuff can happen in the background.  Here is the loop code that pins the cpu:

***********code  snip (loop1)

StartTime=Now()
Do While Now() < StartTime + 8.0 / (3600.0 * 24.0)
      '      loop
Loop

***********end code snip

I also tried this loop:

***********code  snip (loop2)

Do While Not oBrowser.readyState = READYSTATE_COMPLETE
'      sometimes this fails--failure is unacceptable
Loop

***********end code snip

FYI, You're probably wondering how the oBrowser object got involved in loop2 (above).  If you want some background on the context. . . I am using this sleep code while a internetexplorer object navigates.  I've found that looping structure #2 doesn't work when a site is a slow loader, i.e., it will say the readystate is complete, but it really isn't!  Additionally, loop2 pins the cpu too and the spawned browser can't download anything.

Below is the complete code for my application if you want to put it all in context run this code below.  For this to work you have to set your ie default tools-options-security-default level to 'low'

***********all code

<html>
<head>
<SCRIPT LANGUAGE="vbscript" >
      function bUpdateAll()
            document.All.whatsup.innerHTML = "starting"
            sUrl = "http://www.aspfree.com"

            const READYSTATE_COMPLETE = 4
            on error resume next

            Set oBrowser = CreateObject("InternetExplorer.Application")

            if err.number <> 0 then            
                  document.All.whatsup.innerHTML = "set your ie default tools-options-security-default level to 'low'"
                  exit function
            end if

            on error goto 0

            oBrowser.Width = 600
            oBrowser.Height = 400
            oBrowser.Left = 50
            oBrowser.Top = 50
            oBrowser.Visible = true      
            oBrowser.Silent = true

            oBrowser.Navigate(sUrl)
            StartTime=Now()
            Do While Not oBrowser.readyState = READYSTATE_COMPLETE
                  '      loop
            Loop
            set oBrowser = nothing
            document.All.whatsup.innerHTML = "done"
      end function
</script>
</head>
<body onload="call bUpdateAll()">
      <div id="whatsup"></div>
</body>
</html>

***********end all code
Start your free trial to view this solution
Question Stats
Zone: Web Development
Question Asked By: tomandlis
Solution Provided By: BChan
Participating Experts: 5
Solution Grade: A
Views: 671
Translate:
Loading Advertisement...
08.19.2004 at 07:53AM PDT, ID: 11842000

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 07:58AM PDT, ID: 11842058

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 08:21AM PDT, ID: 11842375

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 08:47AM PDT, ID: 11842655

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 09:07AM PDT, ID: 11842873

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 09:10AM PDT, ID: 11842912

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 09:14AM PDT, ID: 11842951

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 09:14AM PDT, ID: 11842964

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 09:31AM PDT, ID: 11843147

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 09:52AM PDT, ID: 11843425

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 10:14AM PDT, ID: 11843707

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 10:18AM PDT, ID: 11843761

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 10:24AM PDT, ID: 11843832

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 10:26AM PDT, ID: 11843858

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 11:05AM PDT, ID: 11844368

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 11:09AM PDT, ID: 11844437

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 11:39AM PDT, ID: 11844805

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 12:15PM PDT, ID: 11845179

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 12:19PM PDT, ID: 11845210

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 12:44PM PDT, ID: 11845485

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
08.19.2004 at 12:50PM PDT, ID: 11845551

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
08.19.2004 at 07:53AM PDT, ID: 11842000

Rank: Genius

In general, you don't want to do this. It is much better to arrange your code in such a way this isn't necessary.

FtB
 
08.19.2004 at 07:58AM PDT, ID: 11842058

Rank: Genius

You're trying a server script in client side script.  Would need to be:

<%
     function bSleep()
          Set WScript = Server.CreateObject("WScript.Shell")
          WScript.Sleep 2000
      end function
%>

What you are trying is not possible.  Client side VB will not control sevrer side sleep.  Do you understand the differecne?
 
08.19.2004 at 08:21AM PDT, ID: 11842375

What are you trying to do? if it is client side, and you can use javascricpt, you can use the setTimeout method

self.setTimeout('method()', 5000)  //-- Call method() in 5000 miliseconds

http://www.devguru.com/Technologies/ecmascript/quickref/win_settimeout.html
 
08.19.2004 at 08:47AM PDT, ID: 11842655
You can't do this in ASP because by its very nature, it is single-threaded, and interpreted at runtime. In other words, you can spark up a process as you've done above, wait for it, but you can't go beyond the wait. The only way to effectively do this is to build a multi-threaded COM or ActiveX object that does the processing in the background that periodically checks for the ready state transmitted from the client to the server (though I'm not sure if WScript can actually call WinAPI functions where you can call CreateThread yourself). The object in turn will transfer processing control back to your script once your ready state is achieved.

GoofyDawg
 
08.19.2004 at 09:07AM PDT, ID: 11842873
BChan: yes, I am doing this client side.  Go ahead and copy the code into a asp page and it will work.

GoofyDawg:  In the '***********all code' section in my original question (above) I believe the internetexplorer.application object is asynchronous, i.e., I spawn it and it runs side by side with my vbscript code.  

I think, the problem stems from the fact that the vbscript code will pin the cpu when running the 'do while' loop, thus the spawned browser can't get many cpu cycles to download content.  If the vbscript code could just sleep for a second and give up some cycles then the spawned browser could finish its work (note, the 'all code' will work, as is, but sometimes not when you're navigating to a really slow site it fails--which is my problem).
 
08.19.2004 at 09:10AM PDT, ID: 11842912
Bchan, is there a way to do the settimeout in vbscript?  I'd rather not convert all my code to javascript

alorentz, oh, I didn't realize that wscript wasn't available on the client side.  But, if that is so, then why doesn't the script bomb when I create the wscript object?
 
08.19.2004 at 09:14AM PDT, ID: 11842951
 
08.19.2004 at 09:14AM PDT, ID: 11842964

Rank: Genius

When you execute a wscript shell, it is running on the server, not the client machine. Otherwilse, I could call a script that would delete files on a client's machine and etc.

This brings me back to my first point--it is best not to build something that is going to require a wait as this is a bad situation for the server to be in.

FtB
 
08.19.2004 at 09:31AM PDT, ID: 11843147
tomandlis,
Why not use the window.open method?
window.open("Sample.htm",null,
    "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no");
What is the goal of your script?

You might be able to use this, or another approacr, such as an iframe. You then will not need to have the security settings change.
 
08.19.2004 at 09:52AM PDT, ID: 11843425
bchan, I believe window.open is a javascript function.  Please note that this is in vbscript.

If you really want to know the purpose of this script is essentially screen scraping

1. have the client side browser go to a site
2. navigate (click) a few links on that site to get to a destination page
3. gather info from the destination page
4. submit the gathered information via http to my servers

simple huh

I do step 4 by spawning a new browser and constructing a simple form (containing the gathered information) that has its 'action' set to a receiving page on my site.  

Why do this you ask?  Simple, because the screen scaping can only be done from a client-side browser that accepts cookies.--The site being scrapped is password protected.
 
08.19.2004 at 10:14AM PDT, ID: 11843707

Rank: Genius

I wonder if there isn't any way to use something like this for scraping:

Function GetHTML(strURL)
      Dim objXMLHTTP, strReturn
      Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
      objXMLHTTP.Open "GET", strURL, False
      objXMLHTTP.Send
      strReturn = objXMLHTTP.responseText
      Set objXMLHTTP = Nothing
      GetHTML = strReturn
End Function

FtB
 
08.19.2004 at 10:18AM PDT, ID: 11843761
fritz, yes your code will work.  However, it doesn't work very well with cookies because some pages will check to see if you have a cookie (password protected site).  Consequently, it is better to just click links using a internetexplorer object when scraping pwd protected sites.

Also, your script only works server side and that will put a drag on the server.  Better to distribute something like this to the client.
 
08.19.2004 at 10:24AM PDT, ID: 11843832
Anyway, we've gotten a little off track here.  Remember, the original question is rather simple-- How can you get a client side vbscript to sleep while browsing with an internetexplorer activex object ?

So far the answers seem to be you can't unless you convert it to javascript, but I'll need an example of that (that doesn't pin the cpu) to accept that answer.

BTW, if you can remove the internetexplorer object from the equation (and still scape contents) I'll accept that too.
 
08.19.2004 at 10:26AM PDT, ID: 11843858

Rank: Genius

Still going with my original answer: don't do it--program around it instead.

FtB
 
08.19.2004 at 11:05AM PDT, ID: 11844368
You can call javascript function from a vb:

<html>
<head>
<SCRIPT LANGUAGE="vbscript" >
     function bUpdateAll()
          document.all.whatsup.innerHTML = "starting"
          sUrl = "http://www.aspfree.com"

          const READYSTATE_COMPLETE = 4
          on error resume next

          Set oBrowser = CreateObject("InternetExplorer.Application")

          if err.number <> 0 then          
               document.all.whatsup.innerHTML = "set your ie default tools-options-security-default level to 'low'"
               exit function
          end if

          on error goto 0

          oBrowser.Width = 600
          oBrowser.Height = 400
          oBrowser.Left = 50
          oBrowser.Top = 50
          oBrowser.Visible = true    
          oBrowser.Silent = true

          oBrowser.Navigate(sUrl)
         bSleep() 'Call js function that sleeps
         ' StartTime=Now()
         ' Do While Not oBrowser.readyState = READYSTATE_COMPLETE
               '     loop
         ' Loop
          set oBrowser = nothing
          document.All.whatsup.innerHTML = "done"
     end function
</script>
</head>
<body onload="call bUpdateAll()">
     <div id="whatsup"></div>
</body>
</html>




<SCRIPT LANGUAGE="vbscript" >
   
     function FWake()
          document.all.whatsup.innerHTML = "Im awake"            

     end function
</script>
<SCRIPT LANGUAGE="javascript" >
 function bSleep(){

          document.all.whatsup.innerHTML = "Sleeping"            
            window.setTimeout( "FwAKE()", 5000); <!-- change 5000 to your wait time-->
                     

      }
</SCRIPT  >
<Div ID=whatsussp>NOTHING</Div >

Accepted Solution
 
08.19.2004 at 11:09AM PDT, ID: 11844437

Rank: Genius

>>Anyway, we've gotten a little off track here.  Remember, the original question is rather simple-- How can you get a client side vbscript to sleep while browsing with an internetexplorer activex object ?

I agree - not a good idea, and will be unreliable regardless.
 
08.19.2004 at 11:39AM PDT, ID: 11844805

Rank: Genius

>>Set oBrowser = CreateObject("InternetExplorer.Application")<<

Oh, please don't do that--Microsoft warns against it:

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q257/7/57.ASP&NoWebContent=1

FtB
 
08.19.2004 at 12:15PM PDT, ID: 11845179
bChan!  You rock.  I used your suggestion.  Try the code below.  It works and it doesn't pin the cpu.  


<html>
<head>
<SCRIPT LANGUAGE="vbscript" >
      dim oBrowser
     function bUpdateAll()
          document.all.whatsup.innerHTML = "starting"
          sUrl = "http://www.aspfree.com"

          const READYSTATE_COMPLETE = 4
          on error resume next

          Set oBrowser = CreateObject("InternetExplorer.Application")

          if err.number <> 0 then          
               document.all.whatsup.innerHTML = "set your ie default tools-options-security-default level to 'low'"
               exit function
          end if

          on error goto 0

          oBrowser.Width = 600
          oBrowser.Height = 400
          oBrowser.Left = 50
          oBrowser.Top = 50
          oBrowser.Visible = true    
          oBrowser.Silent = true

          oBrowser.Navigate(sUrl)
         bSleep(1) 'Call js function that sleeps
         
          document.All.whatsup.innerHTML = "done"
     end function

      function FWake(linkcase)
            document.all.whatsup.innerHTML = "Im awake: " '& oBrowser.readyState
            EndTime = Now() + 5.0 / (3600.0 * 24.0)
            Do While Now() < EndTime and Not (oBrowser.readyState = READYSTATE_COMPLETE)
                  ' Empty loop forces script to wait.                  
            Loop
            if linkcase = 1 then
                  bTemp = bClickLink("utilize")
                  bSleep(2)
            else
                  document.all.whatsup.innerHTML = oBrowser.Document.body.innerHTML
            end if
      end function


      Function bClickLink(sHrefFrag)
            bComplete = true
            bClickLink = false
            Dim x , i
            x = oBrowser.Document.links.Length
            Dim s , sTheLink
            For Each oLink In oBrowser.Document.links
                  sTemp = sTemp & "<br/>link: " & oLink.getAttribute("href")
                  If InStr(1, oLink.getAttribute("href"), sHrefFrag, vbTextCompare) > 0 Then
                        document.All.whatsup.innerHTML = "<p>clicked: " & oLink.getAttribute("href")
                        oLink.Click
                        bClickLink = True
                        Exit For
                  End If
            Next
      End Function
</script>
<SCRIPT LANGUAGE="javascript" >
      function bSleep(theCase){
            sFunc = "FWake(" + theCase + ")";
            document.all.whatsup.innerHTML = "Sleeping";
            window.setTimeout( sFunc, 5000);
      }
</SCRIPT>
</head>
<body onload="call bUpdateAll()">
     <div id="whatsup">Nothing</div>
</body>
</html>
 
08.19.2004 at 12:19PM PDT, ID: 11845210
Fritz, the article says you shouldn't do it serverside.  The code above is client side.
 
08.19.2004 at 12:44PM PDT, ID: 11845485
hmm, I think I found a way to do it all within vbscript here:

http://www.codeproject.com/asp/webtimer.asp
 
08.19.2004 at 12:50PM PDT, ID: 11845551
Here is the code for the timer.  I think I'm going to use this code as it is a little cleaner, but BChan you were a big help and deserve the points.

Thanks

<HTML>
<HEAD>
<title>Demonstration</title>
<SCRIPT LANGUAGE="VBScript">
<!--
      Dim intTimerID
      hr=0            'change hours
      min=2            'change minutes
      sec=0            'change seconds
      
      Sub HandleTime
      if hr=0 and min=0 and sec=0 then
            endtime
      elseif min>=0 and sec>0 then
            sec=sec-1
            status=hr & ":" & min & ":" & sec
            intTimerID=setTimeOut("HandleTime",950, "VBScript")
      elseif min>0 and sec=0  then
            min=min-1
            sec=59
            status=hr & ":" & min & ":" & sec
            intTimerID=setTimeOut("HandleTime",950, "VBScript")
      elseif hr>=0 and min=0 then
            hr=hr-1
            min=59
            sec=59
            status=hr & ":" & min & ":" & sec
            intTimerID=setTimeOut("HandleTime",950, "VBScript")
      end if
      End Sub
      
      Sub endtime
            cleartimeout intTimerID
              status = "Your Time Ended"
            msgbox "Time Up"
      end sub

      status=hr & ":" & min & ":" & sec
      intTimerID=setTimeOut("HandleTime",950, "VBScript")
-->
</SCRIPT>
</HEAD>

<BODY>
      <h3>You’ll see a message box when the time is up.</h3>
      <hr>
      <br><input type="button" value="Click before time is up" onclick="call endtime">
</BODY>
</HTML>
 
 
02.14.2008 at 03:37PM PST, ID: 20898024
 
 
 
20080236-EE-VQP-29