Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Timer function

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,63950
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Timer function
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Timer function - 9/1/2008 12:34:16 AM   
  smithcza

 

Posts: 4
Score: 0
Joined: 9/1/2008
Status: offline
Hi all

I need to run a certain sub in vbcsript every 10 seconds?

What would be the easiest to achieve this?

Regards,

smithcza
 
 
Post #: 1
 
 RE: Timer function - 9/1/2008 4:25:15 AM   
  yfki

 

Posts: 78
Score: 0
Joined: 12/12/2007
Status: offline

      

(in reply to smithcza)
 
 
Post #: 2
 
 RE: Timer function - 9/1/2008 7:52:26 PM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
You should take a look at DO...LOOP


      

This will call the sub once every 10 seconds.  Once it has done it 5 times, it will exit the loop.
Always critical to add in a way to exit the loop...
Nothing says I wanna Shoot Myself like having to hardboot your box because a loop has gone into infinite cycles, and your CPU is pegged!

< Message edited by DiGiTAL.SkReAM -- 9/2/2008 2:44:12 AM >


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to yfki)
 
 
Post #: 3
 
 RE: Timer function - 9/1/2008 9:31:48 PM   
  smithcza

 

Posts: 4
Score: 0
Joined: 9/1/2008
Status: offline
This might sound stupid but I get a "Microsoft VBScript runtime error: Object required: 'WScript'" error.

I also got some other code from VBA that will run every 10 seonds, but this locks me out of the form, I can't do anything on the form while the loop runs. I need a option to bomb it out of the loop manually.

      

DoEvents is VBA, doesn't work with vbscript.

Thanks,

smithcza

(in reply to DiGiTAL.SkReAM)
 
 
Post #: 4
 
 RE: Timer function - 9/2/2008 2:45:50 AM   
  DiGiTAL.SkReAM


Posts: 1184
Score: 7
Joined: 9/6/2005
From: Florida, USA
Status: offline
I modified my earlier code - it was aircode, and I had put Exit Loop instead of Exit Do.

Anyways, what environment are you running the code in?  if youa re saving it to a .vbs file and then running that file form windows, and are still getting the object error referencing WScript, you might want to reinstall WSH.


_____________________________

"Would you like to touch my monkey?" - Dieter (Mike Meyers)

"It is better to die like a tiger, than to live like a pussy."
-Master Wong, from Balls of Fury

(in reply to smithcza)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Timer function Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts