Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > microsoft.public.scripting.vbscript > #12041

Re: Select All and Copy to clipboard web page with VBScript

From "Mayayana" <mayayana@invalid.nospam>
Newsgroups microsoft.public.scripting.vbscript
Subject Re: Select All and Copy to clipboard web page with VBScript
Date 2019-01-30 09:30 -0500
Organization A noiseless patient Spider
Message-ID <q2scgs$7e5$1@dont-email.me> (permalink)
References <utea3l7ppi2uc5@corp.supernews.com> <#BiLLDgjCHA.3736@tkmsftngp08> <b447193c.0212150215.5c5ee83b@posting.google.com> <9ef1a9b4-243b-43db-97db-56e033842348@googlegroups.com>

Show all headers | View raw


<sandcastle10191@gmail.com> wrote

| You can do below way
|
| Set ie = createobject("internetexplorer.application")
| Ie.navigate = "yahoo.com"
| Do while ie.readystate<>4 :wscript.sleep(100):loop
| X=IE.document.body.innertext
| Set wsh= createobject ("wscript.shell")
| Set clip = wsh.exec("clip")
| Clip.stdin.write (X)

  You have numerous errors there. Obviously you never
tried your own code. And why would you want to
transfer webpage text to a console window?

Errors: IE.Navigate is not a property but a method.
There's no "=". document.body only works for quirks mode.
WSHShell is not necessary. You should call Quit on IE
when you're done. It's an application object that runs
in its own process. It doesn't die with your script.

'------------------ begin script ---------------
Dim IE, s1, Ret

Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "C:\windows\desktop\test.html"
Do While IE.ReadyState <> 4
  WScript.sleep(100)
Loop

If IE.document.compatMode = "CSS1Compat" Then
     s1 = IE.document.documentElement.innerText
Else
    s1 = IE.document.body.innerText
End If

Ret = IE.document.parentWindow.clipboardData.setData("Text", s1)

IE.Quit
Set IE = Nothing

' You should now be able to paste the text of the webpage
' to notepad to test that it worked. Or if you have some odd
' reason to use a DOS window then you can try to paste it
' there. :)


Back to microsoft.public.scripting.vbscript | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Select All and Copy to clipboard web page with VBScript sandcastle10191@gmail.com - 2019-01-30 05:50 -0800
  Re: Select All and Copy to clipboard web page with VBScript "Mayayana" <mayayana@invalid.nospam> - 2019-01-30 09:30 -0500
    Re: Select All and Copy to clipboard web page with VBScript JJ <jj4public@vfemail.net> - 2019-01-31 12:56 +0700
      Re: Select All and Copy to clipboard web page with VBScript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-01-31 09:59 +0100
        Re: Select All and Copy to clipboard web page with VBScript JJ <jj4public@vfemail.net> - 2019-02-01 15:44 +0700
          Re: Select All and Copy to clipboard web page with VBScript JJ <jj4public@vfemail.net> - 2019-02-01 16:05 +0700
          Re: Select All and Copy to clipboard web page with VBScript "Mayayana" <mayayana@invalid.nospam> - 2019-02-01 08:46 -0500
            Re: Select All and Copy to clipboard web page with VBScript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-02-01 22:55 +0100
              Re: Select All and Copy to clipboard web page with VBScript "Mayayana" <mayayana@invalid.nospam> - 2019-02-01 19:14 -0500
                Re: Select All and Copy to clipboard web page with VBScript "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2019-02-02 15:17 +0100
            Re: Select All and Copy to clipboard web page with VBScript JJ <jj4public@vfemail.net> - 2019-02-02 05:20 +0700
      Re: Select All and Copy to clipboard web page with VBScript "R.Wieser" <address@not.available> - 2019-01-31 10:03 +0100
      Re: Select All and Copy to clipboard web page with VBScript "Mayayana" <mayayana@invalid.nospam> - 2019-01-31 09:05 -0500
        Re: Select All and Copy to clipboard web page with VBScript "Mayayana" <mayayana@invalid.nospam> - 2019-01-31 11:14 -0500
          Re: Select All and Copy to clipboard web page with VBScript JJ <jj4public@vfemail.net> - 2019-02-01 16:30 +0700
        Re: Select All and Copy to clipboard web page with VBScript JJ <jj4public@vfemail.net> - 2019-02-01 16:28 +0700
          Re: Select All and Copy to clipboard web page with VBScript "Mayayana" <mayayana@invalid.nospam> - 2019-02-01 08:49 -0500
  Re: Select All and Copy to clipboard web page with VBScript "Dave \"Crash\" Dummy" <invalid@invalid.invalid> - 2019-01-31 09:06 -0500

csiph-web