Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

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

Hi,

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.

Code:
#$language = "VBScript"
#$interface = "1.0"
Set objTab = crt.GetScriptTab
objTab.Clone
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
  #2  
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?
__________________
--Todd

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

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

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

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.