|
| |||||||||
| Tags: clipboard, copy, internet explorer, parentwindow, vbscript |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Not able to Copy in Clipboard using VBScript
I am using the notepad for writing the codes in VBScript. Also I don't want to use anything else than the notepad. I am facing a problem while making project. My problem is that I am not able to Copy in Clipboard using VBScript.! I have tried to make coding but that is not coping the things actually. Can someone tell me the coding for that. Please provide me coding as soon as possible. Thanks in Advance..
__________________ "All gave some, some gave all." |
|
#2
| |||
| |||
| Re: Not able to Copy in Clipboard using VBScript
I think that it will be better if you provide us the sample of the script that you made for Copying data in Clipboard using VBScript. Because instead of telling you the whole program, it will be better for me (maybe others) to tell you the exact place where you are going wrong.!! Also by that code i can come to know what exactly you want to do.!?! So post us the code..! ![]() |
|
#3
| ||||
| ||||
| Re: Not able to Copy in Clipboard using VBScript
Thanks for replying me and also for trying to solve my problem. I have written script but it does not really copy the data from the clipboard, it will just write it to the file immediately, without copying. Here is my script : Code: strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\cimv2")
Set colItems = objWMI.ExecQuery _
("Select * from Win32_Proxy",,50)
For Each objItem in colItems
ProxyServer = objItem.ProxyServer
ProxyPortNumber = objItem.ProxyPortNumber
Next
Proxy = InputBox("Do you want to save the IP to disk?.","Here's your IP and Port.",""&ProxyServer &":" &ProxyPortNumber,800,600)
If Proxy = 1 Then
With Clipboard
.Clear
.SetText(""& ProxyServer)
End With
msgbox("Copied")
Else msgbox("Copy Failed")
End If
__________________ "All gave some, some gave all." |
|
#4
| ||||
| ||||
| Re: Not able to Copy in Clipboard using VBScript
According to me you need a parent window to copy something to the clipboard. I think that you should try the following coding : Code: Set objHTML = CreateObject("htmlfile")
ClipboardText = objHTML.ParentWindow.ClipboardData.GetData("text")
MsgBox ClipboardText |
|
#5
| ||||
| ||||
| Re: Not able to Copy in Clipboard using VBScript
You should try the following code for Copying Data in Clipboard using VBScript. Hope that after creating the object you will able to copy the data. Here is the code for that : Code: Set objIE = CreateObject("InternetExplorer.Application")
objIE.Navigate("about:blank")
objIE.document.parentwindow.clipboardData.SetData "text", strCopy
strCopy = "This text has been copied to the clipboard."
objIE.Quit |
|
#6
| |||
| |||
| Re: Not able to Copy in Clipboard using VBScript
I have provided you the script. You will have to copy path script with self register function and your problem will get solved. Code: <!-- FileName:CopyPath.hta -->
<hta:application ID="HTA" windowstate="maximize">
<script language=vbs>
Const TKey1 = "HKCR\*\shell1\CopyPath\", Tkey2 = "HKCR\Directory1\shell\CopyPath\"
Const sMenu = "Copy FullPath(&F)"
Dim Arg,
Dim pPath,
Arg = Mid(HTA.commandLine, Len(document.urlunencoded) + 4)
If Arg = "" Then
pPath = document.urlunencoded
Reg_UnReg TKey1, sMenu, pPath, False: Reg_UnReg TKey2, sMenu, pPath, True
Else
Me.clipboarddata.setdata "Text", Arg
End If
Me.Close
'
Sub Reg_UnReg(Key, Menu, Path, PopUp)
Dim ENo
With CreateObject("WScript.Shell")
.SendKeys "{F10}{ESC}", True
On Error Resume Next: .RegRead Key: ENo = Err.Number: On Error GoTo 0
If ENo <> 0 Then
.RegWrite Key, Menu
.RegWrite Key & "command\", "mshta """ & Path & """ %L"
If PopUp Then .PopUp "Added to context menu.", 1
Else
.RegDelete Key & "command\": .RegDelete Key
If PopUp Then .PopUp "Deleted from context menu.", 1
End If
End With
End Sub
</script> |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Not able to Copy in Clipboard using VBScript" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Cannot copy or paste to clipboard | John K. | MS Office Support | 6 | 11-12-2010 02:38 PM |
| Windows 7: ctrl+C cannot copy onto the clipboard | The!Winston | Operating Systems | 5 | 02-12-2010 07:44 AM |
| Code to copy to clipboard | Brunoz | Software Development | 3 | 24-11-2009 01:42 PM |
| Copy an error message to clipboard | Erskine | Tips & Tweaks | 4 | 06-02-2009 11:29 PM |
| My clipboard is empty but I still cannot copy | Tractorchick | MS Office Support | 1 | 31-10-2006 08:37 AM |