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 08-16-2014, 11:14 PM
sdibias sdibias is offline
Registered User
 
Join Date: Aug 2014
Posts: 2
From VB to Python

Hi Folks!

Just switched my CRT over to my Mac and need help converting my TAC+ login scripts over to python. Below is a sample VB I use, hoping someone can post the equivalent in Python?

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

Sub main
  ' turn on synchronous mode so we don't miss any data
  crt.Screen.Synchronous = True

  ' Wait for a string that looks like "login: " or "Username: "
  crt.Screen.WaitForString "Username: "

  ' Send your username followed by a carriage return
  crt.Screen.Send "steve" & VbCr

  ' Wait for a string that looks like "password: " or "Password: "
  crt.Screen.WaitForString "assword:"

  ' Send your password followed by a carriage return
  crt.Screen.Send "123abc" & VbCr

' Wait for a string that looks like "login: " or ">: "
  crt.Screen.WaitForString ">"

  ' Send your username followed by a carriage return
  crt.Screen.Send "en" & VbCr

  ' Wait for a string that looks like "password: " or "Password: "
  crt.Screen.WaitForString "assword:"
 
 ' Send your password followed by a carriage return
  crt.Screen.Send "abc123" & VbCr

  ' turn off synchronous mode to restore normal input processing
  crt.Screen.Synchronous = False
End Sub
Reply With Quote
  #2  
Old 08-18-2014, 07:24 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hello sdibias,

Your best option is to use the script recorder.

For a simple logon script such as posted, I expect it won't need very much post editing and it will allow you to see the indents and structure required by Python.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 08-25-2014, 10:30 PM
sdibias sdibias is offline
Registered User
 
Join Date: Aug 2014
Posts: 2
It worked! I totally forgot about this feature, thanks for the reminder
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 06:11 AM.