Thread: VBS to Python
View Single Post
  #1  
Old 06-03-2021, 09:37 AM
CustomX CustomX is offline
Registered User
 
Join Date: Nov 2020
Posts: 2
Unhappy VBS to Python

Hi, I'm new on Mac platform, but I had been using SecureCRT for a couple of years.

I have a lot of scripts than I use in SecureCRT, thats scripts basically are plain text scripts, for database administration propuse but was called by VBS function.

I'm not programmer, and I am not familiar with python language.

Somebody can help me to translate this block of code to python in order to allow to use my personal scripts in securecrt in mac?

Thanks a lot in advance regarding this and sorry in advance if this not a proper request in this thread.

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

' Script to open a text file and read it line by
' line to a server.

' Constants used by OpenTextFile()
'
Const ForReading = 1
Const ForWriting = 2


Sub Main
  crt.Screen.Synchronous = True
  
  Dim fso, file
  
  Set fso = CreateObject("Scripting.FileSystemObject")

  ' Open a file for writing. The last True parameter causes the file
  ' to be created if it doesn't exist.
  ' strFile = crt.Arguments(0)
  strFile = "F:\SecureCRT\sqlScripts\DBA_Feature_usage.sql"
  Set file = fso.OpenTextFile(strFile, ForReading, False)
 
  Do While file.AtEndOfStream <> True

    str = file.Readline
    crt.Screen.Send str & Chr(13)
    
  Loop

  crt.Screen.Synchronous = False

End Sub
Reply With Quote