First, I am very sorry for this question -perhaps this is a very often asked
question in the newsgroup - but I can not found any code in this newsgroup
or in the internet.
How is it possible to copy a textstring from vbs to the clipboard?
In VB you can use the clipboard object an its methodes.
Further more, do you know some good sites specially for VBS?
Thanx a lot.
George!
I'll give you some sites first ...
This is the best VBScript resource around, but ...
Do you have the MS WSH documentation?
All MS WSH downloads are at the url below. Select
"documentation" from the left column. The downloaded
file will install a chm file with the WSH (VBS-JS)
documentation. This will give you the syntax you need
(at least for the more basic scripting). Also here is a
debugger, an encrypter, and the latest WSH (v5.6)
update (for all OSs other than WinXP - WinXP
updates are included in the OS and IE6 SPs).
MSDN has information on the less common objects that you
may need to access, but it can be quite a bit more difficult to
navigate, and since it addresses the common programming
languages, not just script, it may require some interpretation.
Here are some useful MSDN scripting jump-off pages:
MSDN, Advanced Search
http://search.microsoft.com/advanced_search.asp?siteid=us/dev
MSDN, WMI Scripting Primer
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/html/scripting06112002.asp
MSDN, The Shell Object
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/objects/shell/shell.asp
MSDN, The InternetExplorer Object
http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/reference/objects/internetexplorer.asp
MSDN, HTA Reference
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/hta/reference/hta_ref_entry.asp
For what may be common questions, at odd hours, or to
avoid having to wait for answers on specific questions, you can try
Google Advanced Groups searches on the relevant keywords,
specifying as groups: microsoft.public.scripting.*
http://www.google.com/advanced_group_search?as_ugroup=microsoft.public.scripting.*
There's a tremendous wealth of stored information.
For other sites, try:
The MS TechNet Script Center
Numerous canned scripts on different topics.
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp
Clarence Washington's Site
http://cwashington.netreach.net/
Jim Warrington's Site
http://home.att.net/~wshvbs/
Or sites listed at the InterClasse Links
http://www.interclasse.com/links/index.php
For DHTML references:
MSDN, DHTML-HTML-CSS References
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/DHTML/reference/dhtmlrefs.asp
W3Schools, DHTML Tutorial
Commercial , but much friendlier and easier to use
http://www.w3schools.com/dhtml/default.asp
For the clipboard, from accumulated posts ...
If you can install a third-party ActiveX, check out AutoItX, freeware
by Hiddensoft. It is a good overall addition, has some significant
improvements over straight VBS and has more articulate and reliable
window management, sendkey data, universal shutdowns, and simple
clipboard methods and functions.
http://www.hiddensoft.com/AutoIt/
If you want straight VBS ...
Here is a Walter Zachary workaround to read the clipboard content
with the HTMLFile object:
Set oHtml = CreateObject("htmlfile")
sClipText = oHtml.ParentWindow.ClipboardData.GetData("text")
WScript.Echo sClipText
However, 'htmlfile' only works for reading the clipboard.
For writing to the clipboard, the standard trick is to
write to notepad or a text box and transfer. See ...
http://www.borncity.com/WSHBazaar/News7.htm
There's also a script posted there on using the HTML
ExecCommand method for trnsfer.
For writing, you can also use InternetExplorer.Application
(this is untested air code, so test for errors; it's based on
jscript code posted by Christoph):
Set oIE= CreateObject("InternetExplorer.Application")
With oIE
Do: .Navigate "about:clipdata": Loop While .busy
Set oData= .Document.ParentWindow.ClipboardData
End With
oData.SetData("Text", "your text string")
sText= oData.getData("Text")
oIE.Quit
WScript.Echo sText
Per Torgeir Bakken, these methods can result in error messages.
To them, change the IE settings:
Tools \ Internet Options \ Security tab \ Internet \
"Drag and drop or copy and paste files"
from "Prompt" to "Enable" .
or add about:blank and about:clipdata to the "Trusted sites"
security zone if trusted sites are allowed to copy and paste.
Joe Earnest
"Georg Hasenöhrl" <g...@hakom.at> wrote in message
news:dUq0a.6$N3....@stuart.coltnet.at...
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.410 / Virus Database: 231 - Release Date: 10-31-02
set ie=createobject("internetExplorer.application")
ie.navigate "about:blank"
do until ie.readystate=4: wscript.sleep 1: loop
ie.document.parentwindow.clipboardData.setData "Text", "test"
--
Have a nice day.
Han Pohwan, Microsoft MVP, Korea
"Georg Hasen?rl" <g...@hakom.at> wrote in message
news:dUq0a.6$N3....@stuart.coltnet.at...