#1
|
|||
|
|||
Reading SecureCRT output from Excel VBA
I see all the examples provided here
What I haven't been able to find is the ability to read the output from a session created from within Excel, then read the data from SecureCRT back to Excel, parse and write it to specific cells. For example, I used the example script "ConnectToSecondaryHost_via_JumpHost_ShellDriverExcel.bas" to connect to a device, run a custom script. I want to take the output from that script and put it back into excel. This has to be done from Excel. Is this possible? |
#2
|
|||
|
|||
Hi djvj,
What you are asking sounds like the Reading and Writing example found at the forum thread you referenced. In what way does that not meet your needs? What parsing needs done to the data you plan to put into Excel?
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#3
|
|||
|
|||
Hi Brenda,
Reading and Writing example is done from SecureCRT, not from launching SecureCRT within Excel, telling SecureCRT what to do, then bringing the data back to Excel. Basically extending the ConnectToSecondaryHost_via_JumpHost_ShellDriverExcel example to get the output back to the same Excel spreadsheet. Last edited by djvj; 05-27-2021 at 10:46 AM. |
#4
|
|||
|
|||
Hi djvj,
Sorry, I did not pickup on that distinction. I was thinking session *data* would be stored in Excel and you would use that for the SecureCRT session. Correct, SecureCRT is not externally scriptable, so that's not currently possible. I have added this thread to a feature request in our product enhancement database to expose CRT object API so external programming editors can reference methods and properties. Should a future release of SecureCRT include this feature, notification will be posted here. If you prefer direct email notification, send an email to support@vandyke.com and include Feature Request - Forum Thread #14545 in the subject line or use this form from the support page of our website.
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#5
|
|||
|
|||
Ok Thank you. I was hoping for some ability to do now. I'll play around with the dynamic script option and see if I can figure something out for now. Just not sure an open workbook is writable from outside like that.
|
#6
|
|||
|
|||
Hi djvj,
I believe it is because the aforementioned script does it. ![]()
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#7
|
|||
|
|||
It does? I thought that was launched from SecureCRT...hmm ok I'll dive into that a little more then.
I thought the end of this meant it was launched from CRT: ' This example Script shows how to read (and write) data to (and from) an ' Excel spreadsheet using VBScript running within SecureCRT. Thanks. |
#8
|
|||
|
|||
Hi djvj,
Your statement was: Quote:
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#9
|
|||
|
|||
Ah right, thanks for the clarification.
|
#10
|
|||
|
|||
Hi djvj,
Since your title mentions VBA I see what might be causing confusion. You can use VBScript in SecureCRT, as was done for those example scripts. SecureCRT supports VBScript (ActiveX scripting languages) and Python. Not VBA.
__________________
Thanks, --Brenda VanDyke Software Technical Support support@vandyke.com (505) 332-5730 |
#11
|
|||
|
|||
Right, it can be confusing. But yea since Excel uses VBA, and the syntax is the same as VBS, just thought SecureCRT supported VBA.
Now Python I'm good with if my solution could be had using that language, but Excel doesn't support that. So still back to square one. UPDATE I played around with the read/write VBS script example. So it works with writing to excel fine, but its limit is if the workbook is open, it doesn't update it. The workbook has to be closed, which doesn't work for what I'm trying to do. Brings me back to my initial request. For the time being, I'm going to try and get creative and use a 2nd workbook to control the one I want to update. In my head it should work, but not as intuitive and much more convoluted vs quickly updating a couple of cells. Last edited by djvj; 05-28-2021 at 01:10 AM. |
#12
|
||||
|
||||
There's no "SecureCRT" object for Excel VBA to control, manage, or interact with. SecureCRT doesn't expose it's internal scripting interface to any outside elements.
If you want to control everything from within your Excel VBA, then you may want to consider alternative approaches for getting the data back into Excel. For example:
--Jake
__________________
Jake Devenport VanDyke Software Technical Support YouTube Channel: https://www.youtube.com/vandykesoftware Email: support@vandyke.com Web: https://www.vandyke.com/support |
#13
|
|||
|
|||
Thanks Jake.
I've been writing up an implementation that will do something similar to what you describe in the past week. It's coming along slowly, but getting there. Hopefully one day SecureCRT can open an API or VBA interface of sorts one day so much of my script can be simplified. |
#14
|
||||
|
||||
Quote:
What kind(s) of device(s) is SecureCRT connecting to? What sort of commands are you sending from SecureCRT to these devices once connected? What kind of output are you hoping to gather? --Jake
__________________
Jake Devenport VanDyke Software Technical Support YouTube Channel: https://www.youtube.com/vandykesoftware Email: support@vandyke.com Web: https://www.vandyke.com/support |
#15
|
|||
|
|||
Quote:
My scripts connect to cisco, casa, arris, & nokia devices. Quote:
I parse the output using regex, so that's something I can already do relatively easy. But basically run a single command, parse output, then dump into an existing spreadsheet in specified sheet/cell. Move on to next command. I have this running in VB at the moment, but would be a lot faster if I could talk directly to CRT or possibly even a Python/CRT combo. There are a number of ideas I have in my head. |
![]() |
Thread Tools | |
Display Modes | Rate This Thread |
|
|