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


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

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-31 09:05 -0500
Organization A noiseless patient Spider
Message-ID <q2uve7$ggc$1@dont-email.me> (permalink)
References (1 earlier) <#BiLLDgjCHA.3736@tkmsftngp08> <b447193c.0212150215.5c5ee83b@posting.google.com> <9ef1a9b4-243b-43db-97db-56e033842348@googlegroups.com> <q2scgs$7e5$1@dont-email.me> <1x5punk0fd6dh.trc75bdws3g0$.dlg@40tude.net>

Show all headers | View raw


"JJ" <jj4public@vfemail.net> wrote

| Darn it. I use "HTMLFile" object to read the clipboard like below.
|
|  txt = createobject("htmlfile").parentwindow.clipboarddata.getdata("text")
|  wsh.echo txt
|

   I'd forgotten all about htmlfile. I assume it's essentially
an IE instance. But I must admit I have very little experience
with that or with using the clipboard. I just don't normally
need the clipboard in something like an HTA. I also didn't know
about the security issues. On my main machine I'm running IE6.

I don't know about security for the following, but you
can try it. It's a cleaner version of Evertjan's javascript
method. (Who knew there were so many options?!)
execCommand deals with the DOM. The cut/copy/paste
options are odd in that context, since that kind of thing
can be done with a Textrange. But there they are.

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

IE.ExecWB 17, 2  '-- select all. don't prompt user.
IE.ExecWB 12, 2  '-- copy. don't prompt user.

IE.Quit
Set IE = Nothing

  ExecWB, for anyone who may not know, is basically
access to the IE or Web Browser control menu. The
first parameter is the menu item. The second is
behavior:

DODEFAULT        = 0,
PROMPTUSER       = 1,
DONTPROMPTUSER    = 2,
SHOWHELP         = 3

  3rd and 4th parameters are optional and vary depending
on what the 1st is. Unfortunately, the docs aren't very
good. I've never seen an exhaustive listing of all options.

Parameters 3 and 4 are in/out paramters, pavIn, pvaOut.
They seem to be used for setting/ returning zoom level,
respectively, but not for much else. But there is some
explanation under the docs for the first parameter enum:

First parameter:

OLECMDID_OPEN              = 1,
     OLECMDID_NEW               = 2,
     OLECMDID_SAVE              = 3,
     OLECMDID_SAVEAS            = 4,
     OLECMDID_SAVECOPYAS        = 5,
     OLECMDID_PRINT             = 6,
     OLECMDID_PRINTPREVIEW      = 7,
     OLECMDID_PAGESETUP         = 8,
     OLECMDID_SPELL             = 9,
     OLECMDID_PROPERTIES        = 10,
     OLECMDID_CUT               = 11,
     OLECMDID_COPY              = 12,
     OLECMDID_PASTE             = 13,
     OLECMDID_PASTESPECIAL      = 14,
     OLECMDID_UNDO              = 15,
     OLECMDID_REDO              = 16,
     OLECMDID_SELECTALL         = 17,
     OLECMDID_CLEARSELECTION    = 18,
     OLECMDID_ZOOM              = 19,
     OLECMDID_GETZOOMRANGE      = 20
     OLECMDID_UPDATECOMMANDS    = 21
     OLECMDID_REFRESH           = 22
     OLECMDID_STOP              = 23
     OLECMDID_HIDETOOLBARS      = 24
     OLECMDID_SETPROGRESSMAX    = 25
     OLECMDID_SETPROGRESSPOS    = 26
     OLECMDID_SETPROGRESSTEXT   = 27
     OLECMDID_SETTITLE          = 28
     OLECMDID_SETDOWNLOADSTATE  = 29
     OLECMDID_STOPDOWNLOAD      = 30

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


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