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-24-2018, 09:39 AM
hooknife hooknife is offline
Registered User
 
Join Date: Mar 2007
Posts: 34
VBScript help (looping and sending key strokes)

I'm very new to scripting. Any help you can provide is much appreciated.

I want to be able to do the following...
  1. Start script manually
  2. Script should send the "up arrow"
  3. wait one second
  4. send "enter" key
  5. wait one second
  6. send "up arrow" again
  7. send "enter" key
  8. and keep looping this until I stop the script manually

Last edited by hooknife; 10-24-2018 at 10:08 AM.
Reply With Quote
  #2  
Old 10-24-2018, 10:48 AM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 89
Hi hooknife,

Here is an example VBScript that will allow you to accomplish this:

Code:
# $language = "VBScript"
# $interface = "1.0"

Do
    crt.Screen.Sendkeys("{Up}")
    crt.Sleep 1000
    crt.Screen.Send vbcr
    crt.Sleep 1000
Loop

As you can see, I used crt.Screen.Sendkeys to send the up arrow {Up} and crt.Screen.Send to send "enter" (vbcr).

You can increase the "pause" time by increasing or decreasing the crt.Sleep value, in milliseconds.

You can run the script by navigating to "Script" on the SecureCRT main menu and selecting "Run...", or you can create a button on your Button Bar to run the script when pressed.

For more information about the Button Bar please refer to our YouTube video, "SecureCRT's Button Bar".
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 10-24-2018, 10:54 AM
hooknife hooknife is offline
Registered User
 
Join Date: Mar 2007
Posts: 34
Thank you for the help.

How do I stop it from looping?
Reply With Quote
  #4  
Old 10-24-2018, 11:39 AM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 89
Hi hooknife,

The script, as is, can be stopped by navigating to "Script" on the main menu and pressing "Cancel".

Does this work for you? If not, can you tell me more about what you are trying to accomplish specifically?
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 10-25-2018, 07:48 AM
hooknife hooknife is offline
Registered User
 
Join Date: Mar 2007
Posts: 34
Again, thank you!
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:23 AM.