Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-30-2014, 07:57 AM
kgaudineer kgaudineer is offline
Registered User
 
Join Date: Jan 2011
Posts: 15
Need delay between commands....

I am trying to write a script for a managed power supply I have. The goal is to telnet to the managed power supply.... Turn an outlet off.... Wait 30 seconds.... Turn the outlet back on.....

I have the script working except for the wait 30 seconds .... I have tried the crt.sleep but the scripts just stops and the turn on commands don't execute. I did read a post about TimeIt but I can't get that to work. Would that be because I am not replacing the 'N' with the proper value?

Any suggestion on how to get a 30 second delay between the commands to turn off the outlet and turning it back on?
Reply With Quote
  #2  
Old 10-30-2014, 08:37 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,357
Hello kgaudineer,

Is the connection closed when you turn an outlet off?

A crt.sleep (or wscript's sleep method) is a valid way to make the script process inactive for a specified period of time. (I think I know the TimeIt example you are referencing and that is taken directly from the wscript documentation as an example of a timer.)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 10-30-2014, 09:16 AM
kgaudineer kgaudineer is offline
Registered User
 
Join Date: Jan 2011
Posts: 15
Good morning Brenda,

No the connection is not closed when the outlet is shut off I am just taken back to the main menu. from there I wait 30 seconds and then navigate back through the menu choices again but this time I choose 2 instead of 1 to turn the outlet back on.

Could I be using an incorrect value for the crt.sleep? At this time I am using crt.sleep (3000) Should this be higher?
Reply With Quote
  #4  
Old 10-30-2014, 09:23 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,357
Hello kgaudineer,

Thanks for the update.

Yes, the value is milliseconds.

Quote:
Sleep
Description
Specifies the time (in milliseconds) to pause the script's execution.
Remarks
The amount of time that it takes to execute the Sleep() method itself is a factor in how long the script pauses. Therefore, the accuracy of invoking Sleep with small values of 1 or 10 milliseconds will be affected by this overhead.
VBScript
Syntax
crt.Sleep millisec

So if you want to sleep for 30 seconds, the value should be 30000.

Does changing the value help your script execute to completion?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 10-30-2014, 10:25 AM
kgaudineer kgaudineer is offline
Registered User
 
Join Date: Jan 2011
Posts: 15
Thanks for the quick update....

yes. the script is running much better now that I have the value update to 30000 instead of 3000...
Reply With Quote
  #6  
Old 10-30-2014, 10:54 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,357
Hello kgaudineer,

Great! I am glad to hear it.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:55 PM.