Re: Grabbing a string that's already been created in one .vbs file and doing stuff with it in a second .vbs file

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Larry" <larry328NOSPAM@xxxxxxx> wrote in message
news:%23o%23lYih6JHA.1424@xxxxxxxxxxxxxxxxxxxxxxx

James,

It works!

Here's the first .vbs file, which turns the clipboard contents into a
string, and then turns the string into a Volatile Environment item in the
Registry:

Dim oHtml, sText
Set oHtml = CreateObject("htmlfile")

'make string out of text in clipboard
sText = oHtml.parentwindow.clipboardData.getData("text")

Set oWSH = CreateObject("WScript.Shell")
oWSH.Environment("Volatile").Item("zzTestVar") = sText

And here's the second .vbs file, which turns the item that's been reserved
or saved (I don't know the right word) in the Registry into a string, and
then puts the string in the Clipboard and pastes the Clipboard contents:

Dim sText
Set oWSH = CreateObject("WScript.Shell")
sText = oWSH.Environment("Volatile").Item("zzTestVar")

' Put string into Clipboard and paste Clipboard contents

Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
oAutoIt.ClipPut(sText)
oWSH.SendKeys"^v"

And this works noticeably faster than extracting saved text from a
tempfile.
But even more than the increased speed, I like the economy of it. It's
great
to find out that the WSH and Windows have this built in capacity to save
an
item in the system which can be extracted at any time.

The only further refinement, which would be a luxury, not a necessity,
would
be if this could be done with formatted text.

If I read your previous message correctly, you are using Windows 98, is
this correct?


.



Relevant Pages