Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rating: Thread Rating: 12 votes, 4.67 average. Display Modes
  #1  
Old 03-20-2005, 06:32 AM
bking bking is offline
Registered User
 
Join Date: Mar 2005
Posts: 3
Pasting clipboard contents with VBS

Hi All,
I've got some basic VB scripts doing common commands, like:

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

Sub main
crt.Screen.Send "conf t" & VbCr
End Sub

Now I'm looking for the correct syntax / script structure to paste the
clipboard contents into my scrt window.

I've been digging around for help but am a bit overwhelmed with VBS/VBA
so far.

Looks like the VB term I want is Clipboard.GetText , but how to use it ?

Thanks in advance
Reply With Quote
  #2  
Old 03-28-2005, 05:55 AM
buffi buffi is offline
Registered User
 
Join Date: Mar 2005
Posts: 4
Hi,
Here is the complete script.

[code]
#$language = "VBScript"
#$interface = "1.0"


' choose here the serverr you want the script to work on
crt.session.Connect("/s DNS")


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


' Login to DNS

crt.Screen.Send "vipsattech" & vbCr

crt.Screen.WaitForString "word: "

crt.Screen.Send "username" & vbCr

crt.Screen.WaitForString "_dns>"

crt.Screen.Send "en" & vbCr

crt.Screen.WaitForString "word: "

crt.Screen.Send "Password" & vbCr

crt.Screen.WaitForString "_dns#"

crt.Screen.Send "term len 0" & vbCr

'this saves the file

crt.session.LogFileName = "c:\temp\dnslog.txt"
crt.session.Log(true)

'this logs route-cache flow

crt.Screen.Send "sh ip cache flow - or any other command" & vbCr

crt.Screen.WaitForString "_dns#"

crt.Screen.Send "run another command here" & vbCr

crt.Screen.WaitForString "_dns#"

crt.Screen.Send "exit" & vbCr

crt.Screen.Send "exit" & vbCr

crt.Screen.Synchronous = False


End Sub
[\code]

Hope it help you with something.
This is my script and it works fine
Reply With Quote
  #3  
Old 03-28-2005, 06:16 AM
okstorms's Avatar
okstorms okstorms is offline
Registered User
 
Join Date: Aug 2004
Location: Wilmington, DE
Posts: 38
I don't know what exactly how you want to implement this, but here's some quick code to read the clipboard.

Code:
Set objHTML = CreateObject("htmlfile")
ClipboardText = objHTML.ParentWindow.ClipboardData.GetData("text")
MsgBox ClipboardText
Reply With Quote
  #4  
Old 04-02-2005, 05:09 PM
bking bking is offline
Registered User
 
Join Date: Mar 2005
Posts: 3
Hello,
Thanks for the replies ..

Quote:
Originally Posted by buffi
Hi,
Here is the complete script.

[code]
#$language = "VBScript"
#$interface = "1.0"


' choose here the serverr you want the script to work on
crt.session.Connect("/s DNS")


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


' Login to DNS

crt.Screen.Send "vipsattech" & vbCr

crt.Screen.WaitForString "word: "

crt.Screen.Send "username" & vbCr

crt.Screen.WaitForString "_dns>"

crt.Screen.Send "en" & vbCr

crt.Screen.WaitForString "word: "

crt.Screen.Send "Password" & vbCr

crt.Screen.WaitForString "_dns#"

crt.Screen.Send "term len 0" & vbCr

'this saves the file

crt.session.LogFileName = "c:\temp\dnslog.txt"
crt.session.Log(true)

'this logs route-cache flow

crt.Screen.Send "sh ip cache flow - or any other command" & vbCr

crt.Screen.WaitForString "_dns#"

crt.Screen.Send "run another command here" & vbCr

crt.Screen.WaitForString "_dns#"

crt.Screen.Send "exit" & vbCr

crt.Screen.Send "exit" & vbCr

crt.Screen.Synchronous = False


End Sub
[\code]

Hope it help you with something.
This is my script and it works fine
^ This will just log me in & execute a command .. I'm not sure how you thought that was what I wanted ??

okstorms >> your reply gives some insight, thanks ..

I've pretty much abandoned the pursuit, it's not going to save me enough time to warrant the effort & I'm out of hotkeys already .. thanks anyway !
Reply With Quote
  #5  
Old 04-03-2005, 01:03 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 886
Quote:
Originally Posted by bking
...
Now I'm looking for the correct syntax / script structure to paste the
clipboard contents into my scrt window.
If I understand your situation correctly, you already have some text in the clipboard, and all you want to do is send this data to the remote machine.

Is this correct?

If so, you might try simulating a paste operation by using the following:
crt.screen.SendSpecial "MENU_PASTE"
Does this work for you?
.
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: http://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: http://www.vandyke.com/support
Reply With Quote
  #6  
Old 04-15-2005, 01:04 AM
bking bking is offline
Registered User
 
Join Date: Mar 2005
Posts: 3
Yes, you are correct .. I have some text in clipboard I wish to prepend with some commands, then send with a trailing carriage return.

For example, after copying the word "Hssi 1/0/1.25" running the script would send the command:

sh run interface Hssi 1/0/1.25 <cr>

Unfortunately I have no luck with the above code, sending the special I get:

Error: Send Special: unknown special

Thanks for your help, any more ideas ?!
Reply With Quote
  #7  
Old 04-15-2005, 12:27 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 886
Quote:
Originally Posted by bking
Yes, you are correct .. I have some text in clipboard I wish to prepend with some commands, then send with a trailing carriage return.

For example, after copying the word "Hssi 1/0/1.25" running the script would send the command:

sh run interface Hssi 1/0/1.25 <cr>

Unfortunately I have no luck with the above code, sending the special I get:

Error: Send Special: unknown special

Thanks for your help, any more ideas ?!
Which version are you using (Help / About) ?

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: http://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: http://www.vandyke.com/support
Reply With Quote
  #8  
Old 05-29-2005, 04:48 PM
zerohelp zerohelp is offline
Registered User
 
Join Date: May 2005
Posts: 1
Copy Text To Clipboard Using Vbscript

dim mytext
mytext = Textarea1.Value
call window.clipboardData.setData("Text", mytext)
'THAT IS WHAT I NEEDED
'this copies area of text field objec to clipboard, but for those who want to 'copy just anything:
dim mytext
mytext = "THIS IS JUST ANYTHING ENJOY IT"
call window.clipboardData.setData("Text", mytext)
'next paste clipboard enjoy.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 11:03 AM.