Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-03-2021, 10: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
 

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 03:16 AM.