Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Reply
 
Thread Tools Display Modes
  #1  
Old 05-15-2017, 03:21 PM
vensas3181 vensas3181 is offline
Registered User
 
Join Date: May 2017
Posts: 11
How to code Rows and Cloumns using .vbs script

Hi There,

I have a problem in setting up rows and columns using script with extension .vbs. I tried most possible options but still not able to setup secureCRT screen rows (24) and columns (80).

I am using this version of secureCRT : Version 6.5.0 (build 380)

Any help will would much appreciated.
Reply With Quote
  #2  
Old 05-15-2017, 03:34 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi vensas3181,

I'm sorry you are having trouble. Is there a reason you wish to set it from a script rather than the Session Options?

What problems are you having when you attempt to make the change?

Typically something like the below would work:

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

crt.session.config.setoption "Rows", 50
crt.session.config.setoption "Cols", 100
There are a few additional things you may want to keep in mind when working with screen geometry.

When you connect a session, the window will resize based on the settings in that session regarding rows/columns and the "On resize" configuration. When not connected, SecureCRT should be getting that info from the Default Session. Those configuration options are found in the 'Terminal / Emulation' category of Session Options (or Default Session):

https://www.vandyke.com/support/tips/defaultset.html

Every connection from then on, if you are connecting sessions in tabs, is also going to be controlled by the configuration in that first tabbed session.

This will mean if you have multiple sessions opened and you try to set the rows/columns for a tab other than the first tab it will not have an effect.
__________________
Thanks,
--Eric

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

Last edited by ekoranyi; 05-16-2017 at 08:21 AM.
Reply With Quote
  #3  
Old 05-15-2017, 05:33 PM
vensas3181 vensas3181 is offline
Registered User
 
Join Date: May 2017
Posts: 11
Does it mean that, we need not start session before it start script execution or if we start SecureCRT then it will default to that session option's rather than config settings placed in .vbs script rite?
Reply With Quote
  #4  
Old 05-16-2017, 09:14 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi vensas3181,

No, not exactly. When using tabs in SecureCRT the first tab controls the size of the window. When setting the window size with a script any changes to the first tab will affect all the other tabs. Trying to make changes to any tab other than the first will not work because the first tab controls the window size.

What are you trying to accomplish, it may be easier to just set the rows/columns in the sessions options manually.
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 05-16-2017, 11:59 AM
vensas3181 vensas3181 is offline
Registered User
 
Join Date: May 2017
Posts: 11
Hi, Thanks for your support it did worked in different way. Now I am having issues while using below code. Could you please let me know am I missing anything

Code
-----
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objStream = objFSO.OpenTextFile("C:\Users\vschi420\Desktop\SecureCrt\sessionlog.txt", ForWriting, True)

Error
-----
Invalid procedure call or argument
Reply With Quote
  #6  
Old 05-16-2017, 12:27 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi vensas3181,

It looks like there is a syntax error with how the file is being opened. Instead of using ForWriting you would use a number 2. See below:

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

Set g_fso = CreateObject("Scripting.FileSystemObject")
Set objFile = g_fso.OpenTextFile("C:\Users\TestUser\Desktop\test.txt", 2, True)

objFile.Write "this is a test"
objFile.Close
CONSTANT VALUE DESCRIPTION
ForReading = 1 - Opens a file for reading only
ForWriting = 2 - Opens a file for writing. If the file already exists, the contents are overwritten.
ForAppending = 8 - Opens a file and starts writing at the end (appends). Contents are not overwritten.

Does this help?
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 05-16-2017, 01:25 PM
vensas3181 vensas3181 is offline
Registered User
 
Join Date: May 2017
Posts: 11
Many thanks... your rock star and have all possible options available with you for solutions. It worked for me.

Now, My next query is as below,

I have screen rows and columns like below, (there are many rows for each transaction status type).

Status Date Name
CXL 04/15/17 TestOne
324 04/12/17 TestTwo
RES 04/13/17 TestThree
CXL 04/10/17 Testonemius
456 04/11/17 Something.


I am using below code to fetch each transaction status type and I should be clicking on all selected require transaction's until all require transactions are processed.. (same time I need to write this list into output file). Could you please help me in this ?? I am not able to get what I want using below code

If InStr(nvalue,"CXL")<>0 Then
i = 6
For i = 6 To 25
nProcesses = crt.Screen.Get(i,43,i,75)
nextline = crt.Screen.Get(i+1,43,i+1,75)
If InStr(nProcesses,"CXL") <> 0 Then
' MsgBox nProcesses
CreateObject("WScript.Shell").Popup nProcesses, 1, nProcesses
crt.Screen.Send chr(27) & "D"
'nRow = crt.Screen.CurrentRow
nvalue = crt.Screen.Get(nRow,43,nRow,75)
msgbox nvalue
End If
Next
Reply With Quote
  #8  
Old 05-16-2017, 02:22 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi vensas3181,

I'm glad that helped.

I think I need a little more information about what you are trying to accomplish. When you say you "should be clicking on all selected require transaction's" what does that mean? Is this a menu and you have to use a combination of keys to select each entry? Can you provide an example of what data, and formatting you want in the output file.
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #9  
Old 05-16-2017, 02:48 PM
vensas3181 vensas3181 is offline
Registered User
 
Join Date: May 2017
Posts: 11
Hi Eric,

Here is what I want do as per table provided previously,

1. Identify all transaction (i.e CXL) from the list though they're on same menu . means there could be second, third or so on pages where CXL transaction rows may present. Max is 5 pages
2. Write all CXL transaction rows into output file or write all different transaction rows in to file
3. Select the same type of transaction(s) one by one and enter on that transaction. Then it will open other screen where I need to perform some data input to submit the transaction.
4. Once, record submitted cursor will come back to the transaction screen to pick next transaction line for same transaction and follow Step#3
5. Step#4 and Step#3 will repeat until all transactions related CXL are completed.


This is output file code I am using to write the require information in output file,

Set g_fso = CreateObject("Scripting.FileSystemObject")
Set objStream = g_fso.OpenTextFile("C:\Users\vschi420\Desktop\SecureCrt\sessionlog.txt", 2, True)
Reply With Quote
  #10  
Old 05-16-2017, 03:05 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi vensas3181,

It may be beneficial if you could provide some logging of you completing a couple of example transactions manually with raw logging enabled. We try to keep logs out of the forums to avoid potentially exposing sensitive data. Can you take the following steps and email the log that is generated to Support@VanDyke.com with "Attn: Eric forum post 12701" in the subject?

To create a raw log in SecureCRT:
  • Before connecting with the session, select "Raw Log Session" from SecureCRT's "File" menu.
  • In the "Select Log File" dialog, choose a folder and filename in which you would like the log text to be stored and press the "Save" button. At this point, if you open the "File" menu, you will notice that the "Raw Log Session" menu item now has a check-mark next to it; this indicates that raw logging is activated.
  • Now connect to the remote machine and perform the transactions.
  • After 2-3 transactions, disconnect the session and select "Raw Log Session" from the "File" menu to turn off the raw logging feature.
  • Browse to the location of the raw log file and add the file as an attachment to your email reply.

    NOTICE: The requested troubleshooting data may include sensitive information (usernames, passwords, publicly-accessible host names or IP addresses, etc.).

    Please redact sensitive information that would not be appropriate for email communication prior to sending the requested information.
__________________
Thanks,
--Eric

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #11  
Old 05-22-2017, 11:22 AM
vensas3181 vensas3181 is offline
Registered User
 
Join Date: May 2017
Posts: 11
Hi Eric,

I sent log to you as suggested. Please check and let me know your suggestions

Regards
Venkata
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 04:00 AM.