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-31-2016, 03:13 PM
tparkerMI tparkerMI is offline
Registered User
 
Join Date: Oct 2016
Posts: 4
VBScript: Creating a delay or using sleep

My script uses VBscript. I need to add in a slight pause in my inputs. I tried using crt.Sleep but get the error "Object doesn't support this property or method: 'Sleep'"

Does anyone know what this means? If I can't use sleep, what is the best way to add in a delay?
Reply With Quote
  #2  
Old 10-31-2016, 03:55 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,048
Hi tparkerMI,

What version of SecureCRT are you running?

Please provide further info on what you are trying to accomplish.

Quote:
I need to add in a slight pause in my inputs.
For one thing, the above sounds like your script might have:

Code:
crt.Screen.Send "command1" & vbcr
crt.Screen.Send "command2" & vbcr
crt.Screen.Send "command3" & vbcr
Which is never recommended. You would want to have the appropriate WaitForString() between each send to keep your script in sync.

As for the error reported, I need more context for the error.

What's the exact line of code where you get the error?

Do you perhaps need to reference a tab object instead?
__________________
Thanks,
--Brenda

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

Last edited by bgagnon; 10-31-2016 at 04:50 PM.
Reply With Quote
  #3  
Old 10-31-2016, 05:00 PM
tparkerMI tparkerMI is offline
Registered User
 
Join Date: Oct 2016
Posts: 4
I am trying to modify someone else's code. The person that made the code doesn't work with us anymore. The script is pulling commands and inputs from an excel file to use in CRT. The following is the bit of code that I was trying to use a delay in.

Case "<CTRL-C>"
crt.screen.send Chr(20)
If ManualWaiting <> "Y" then
crt.screen.WaitForCursor(1)
End If

Now that I am getting into this more, I don't think that this "send" is even doing the right thing. It is supposed to be canceling the current action. For reasons beyond my control, when we save certain changes made in CRT it makes you wait up to 30 seconds. But, if you cancel the save and tell it to save again it will save instantly. This is great for when you do it by hand, but the script can't do it, making them sometimes take much longer than excepted. I thought that the problem was that the cancel command would be executed before the waiting started, which caused it to be essentially skipped. Now, I am starting to think that it isn't even sending the right command.

Maybe I should change my question. If the normal key press for canceling an action is "Ctrl+C", what should my script be sending to CRT here? Chr(20) is Device control 4. What does that even mean?
Reply With Quote
  #4  
Old 10-31-2016, 05:06 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,048
Hi tparkerMI,

What version of SecureCRT (or CRT) are you using?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 10-31-2016, 05:07 PM
tparkerMI tparkerMI is offline
Registered User
 
Join Date: Oct 2016
Posts: 4
We are running on SecureCRT 3.4
Reply With Quote
  #6  
Old 11-01-2016, 08:08 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,048
Hi tparkerMI,

That's a really, really old version, about 15 years old.

Sleep() was not a supported method in that version.

As far as the question about Ctrl+C, on my ASCII chart, Ctrl+C is Chr(3). However, you may need the SendKeys() function, which also is not going to be available in SecureCRT 3.4. Upgrading to the current version may resolve the issues you are experiencing. If you contact support@vandyke.com with your serial number, we can check your upgrade eligibility.

Please do not post license info in the public forum.
__________________
Thanks,
--Brenda

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

Last edited by jdev; 11-01-2016 at 05:13 PM. Reason: Correction: Ctrl+C is Chr(3), not 19.
Reply With Quote
  #7  
Old 11-01-2016, 09:19 AM
tparkerMI tparkerMI is offline
Registered User
 
Join Date: Oct 2016
Posts: 4
Thank you! Unfortunately, I do not have any control over which version my company uses. Thank you so much for your help!
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 09:39 AM.