#1
|
|||
|
|||
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? |
#2
|
|||
|
|||
Hi tparkerMI,
What version of SecureCRT are you running? Please provide further info on what you are trying to accomplish. Quote:
Code:
crt.Screen.Send "command1" & vbcr crt.Screen.Send "command2" & vbcr crt.Screen.Send "command3" & vbcr 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. |
#3
|
|||
|
|||
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? |
#4
|
|||
|
|||
Hi tparkerMI,
What version of SecureCRT (or CRT) are you using?
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#5
|
|||
|
|||
We are running on SecureCRT 3.4
|
#6
|
|||
|
|||
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. |
#7
|
|||
|
|||
Thank you! Unfortunately, I do not have any control over which version my company uses. Thank you so much for your help!
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | Rate This Thread |
|
|