Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting


Thread Tools Rate Thread Display Modes
Old 10-18-2015, 10:09 AM
barclays barclays is offline
Registered User
Join Date: Oct 2015
Posts: 2
Continue script in Cloned TAB


I want to make vbs script to first of all clone current tab and then send strings to FRESHLY opened tab.

The problem is: session is cloned, screen focuses on newly opened tab, but script continues to run in the tab where I have started the script. But I want to leave original tab untouched.

#$language = "VBScript"
#$interface = "1.0"
Set objTab = crt.GetScriptTab
crt.Screen.Send "test string" & chr(13)
Please assist on sending "test string" to newly cloned tab, but not to send it to original tab.

Thanks in advance. Jev
Reply With Quote
Old 10-19-2015, 09:55 AM
rtb rtb is offline
VanDyke Technical Support
Join Date: Aug 2008
Posts: 4,305
Hi Jev,

Thanks for the post.

The behavior you are seeing is the direct result of not using the tab object that was created when cloning the script tab. The crt object references the script tab. To reference a tab other than the script tab, you must get a handle to the tab object for the tab you want to access, and then use the handle to interact with the tab.

You may consider reading through the scripting manual for more information about scripting in SecureCRT.

To accomplish your goal, you will need to use something similar to the following to reference the tab that you have cloned:
Set objTab.GetScriptTab
Set objCloneTab = objTab.Clone
objCloneTab.Screen.Send "test string" & vbcr
This is also documented in the Help file under the chapter Scripting / Script Objects Reference / Tab Object.

It is also a good idea to set Synchronous equal to true after cloning the tab so you don't miss data. For example:
Set objTab.GetScriptTab
Set objCloneTab = objTab.Clone
objCloneTab.Screen.Synchronous = True
objCloneTab.Screen.WaitForString "#"
objCloneTab.Screen.Send "test string" & vbcr
Does this help you accomplish your scripting goal?

VanDyke Software
Technical Support

Last edited by rtb; 10-22-2015 at 04:05 PM. Reason: fixing missing word
Reply With Quote
Old 10-22-2015, 04:00 PM
barclays barclays is offline
Registered User
Join Date: Oct 2015
Posts: 2

Thanks, this is exactly what I was looking for.
Assigning new object did the trick.
Reply With Quote

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 10:48 PM.