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 07-22-2016, 10:32 AM
rleon rleon is offline
Registered User
 
Join Date: Jan 2008
Posts: 116
run python script from command line

Is there a way for me to run a python script from the command?

I get the following error

Code:
# python test2.py 
Traceback (most recent call last):
  File "test2.py", line 31, in <module>
    Main()
  File "test2.py", line 8, in Main
    crt.Screen.Synchronous = True
NameError: global name 'crt' is not defined
Reply With Quote
  #2  
Old 07-22-2016, 10:51 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi rleon,

You can run scripts in SecureCRT by using the following:

SecureCRT.exe /Script "Path_to_Script.py"
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 07-22-2016, 11:38 AM
rleon rleon is offline
Registered User
 
Join Date: Jan 2008
Posts: 116
hi

Im on MAC dont have an exe file.

Thanks
Reply With Quote
  #4  
Old 07-22-2016, 11:41 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi rleon,

Sorry, for Mac OS, it would be:

/Applications/SecureCRT.app/contents/MacOS/SecureCRT /Script "Path_to_Script.py"
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 07-22-2016, 01:24 PM
rleon rleon is offline
Registered User
 
Join Date: Jan 2008
Posts: 116
Thanks that worked ..

is there an option that doesnt force a new window to be opened? Ideally I would like to run it from the current session.
Reply With Quote
  #6  
Old 07-23-2016, 12:20 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi rleon,

I am not quite sure what you need.

Does your script include code to logon the remote system?

You can use /S "session_name" to launch a session via the command-line. The /T option opens the connection in a tab. See the Using the Software / Command Line Options topics in SecureCRT's Help file for more info.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
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 01:37 PM.