VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   Access to Windows clipboard (https://forums.vandyke.com/showthread.php?t=10839)

timchampion 01-17-2013 05:10 PM

Access to Windows clipboard
 
Does anyone know if it's possible for a SecureCRT / Python script to access the Windows clipboard? I'm thinking of writing a 'safe-paste' script for Cisco devices.... A user would:

a) copy their config script
b) switch to their CRT session
c) run the script which would start sending the contents of the Windows clipboard line by line.
d) Should the Cisco CLI throw an error, i.e. '% Invalid input detected at '^' marker.' the script would stop sending the remaining config and display a messagebox.

I've found lots of examples of going from screen to clipboard but not the reverse direction.

Cheers,

Tim

rtb 01-18-2013 07:42 AM

Hi Tim,

This should be possible. The SecureCRT Text method in the Clipboard object can be used to either get or set the clipboard contents.

Chapter 8 in the scripting manual discusses various uses of the Clipboard object. It is geared to VBScript, but the SecureCRT methods and objects and concepts used should be translatable to Python. You can find the scripting manual at the following location:
http://www.vandyke.com/support/tips/...ing/index.html
Does this information help you write your script?


All times are GMT -6. The time now is 02:16 PM.