Prev: Packaging Program
Next: Saving picture in VB6
From: John Guarnieri on 10 Oct 2006 08:45 Hi All, Is there a way of doing a select all, copy and paste on a webpage through code without the user seeing the action being preformed? I have code that does all this in the webbrowser control but I want to do it without it being obvious to the user that a select all copy and paste is happening. I want this to happen without the user knowing it. I have my reasons for doing this. Any ideas? TIA John jguarnieri(a)adelphia.net
From: Dag Sunde on 10 Oct 2006 08:58 "John Guarnieri" <jguarnieri(a)adelphia.net> skrev i melding news:dJ6dnQVIauCIC7bYnZ2dnUVZ_qSdnZ2d(a)adelphia.com... > Hi All, > > Is there a way of doing a select all, copy and paste on a webpage through > code without the user seeing the action being preformed? > > I have code that does all this in the webbrowser control but I want to do > it without it being obvious to the user that a select all copy and paste > is happening. I want this to happen without the user knowing it. I have my > reasons for doing this. > > Any ideas? Yes, but you better convince me that your reasons are not malicious. I know nothing of what your app do, so I don't know if the page contains the users account numbers, pin codes and passwords when you grab the content of the page. :-) -- Dag.
From: John Guarnieri on 10 Oct 2006 20:44 Thanks for the reply. No it is not malicious intent. I foundthe following code on planet source code: 1: WebBrowser Tricks 2: Cant touch this Web browser tricks allows you to: select all, copy and paste a webpage and can't touch this will save copied text text to a file named cant touch this.log I want to copy individual workorders from my jobs website and save them to a file. I have done this sucessfully incorporating the above 2 programs with some modifications. I just don't like the looks of the select all and copy routines, I would like it to happen without it being seen by the user. The whole web page gets selected which is what I really want to hide the copy and paste is unseen anyway. Here are the links if you want to try the code. TIA John G. Title: Cant touch this Description: a simple application for internet users. When you copy some text to clipboard , it writes to a log file so then you can see what you copied. ?t is for users who forgets to paste text that he copied to clipboard. This file came from Planet-Source-Code.com...the home millions of lines of source code You can view comments on this code/and or vote on it at: http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=36873&lngWId=1 The author may have retained certain copyrights to this code...please observe their request and the law by reviewing all copyright conditions at the above URL. Title: WebBrowser Tricks Description: This Example Application Demonstates : Enable/Disable Forward and back Buttons, Standard Navigation Buttons, Cut/Copy/Paste/SelectAll edit functions, Auto-Complete Address Box, Saving and Loading MRUs, Avoiding duplicates in Combo/List boxes, The 'about:' Navigation method, Opening and Saving Web Pages, Using Explorers' Find File or Folder Dialog, Finding text on current page, Sizing text on Web pages, Showing a progress guage, Showing Status text, Creating HTML pages at runtime. If I get some interest via the way of votes I'll put up some more This file came from Planet-Source-Code.com...the home millions of lines of source code You can view comments on this code/and or vote on it at: http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=13696&lngWId=1 The author may have retained certain copyrights to this code...please observe their request and the law by reviewing all copyright conditions at the above URL. "Dag Sunde" <me(a)dagsunde.com> wrote in message news:452b98e8$0$16507$8404b019(a)news.wineasy.se... > "John Guarnieri" <jguarnieri(a)adelphia.net> skrev i melding > news:dJ6dnQVIauCIC7bYnZ2dnUVZ_qSdnZ2d(a)adelphia.com... >> Hi All, >> >> Is there a way of doing a select all, copy and paste on a webpage through >> code without the user seeing the action being preformed? >> >> I have code that does all this in the webbrowser control but I want to do >> it without it being obvious to the user that a select all copy and paste >> is happening. I want this to happen without the user knowing it. I have >> my reasons for doing this. >> >> Any ideas? > > Yes, but you better convince me that your reasons are not malicious. > > I know nothing of what your app do, so I don't know if the page contains > the users account numbers, pin codes and passwords when you grab the > content of the page. > > :-) > > -- > Dag. > >
From: mayayana on 10 Oct 2006 23:47 Are you familiar with the document object model (DOM) at all? If you set a reference to mshtml.tlb you'll get "intellisense" for it. The WB.Document object is the same as the IE document object. Document.Body.innerText is the text of the webpage. Everything in the page is accessible through the DOM in one way or another, but it's a vast object model and some of it is poorly designed. It's not always easy to figure out how to get exactly what you want to get.
From: Dag Sunde on 11 Oct 2006 03:45 "mayayana" <mayaXXyana1a(a)mindXXspring.com> skrev i melding news:jPZWg.12426$UG4.2567(a)newsread2.news.pas.earthlink.net... > Are you familiar with the document object model > (DOM) at all? If you set a reference to mshtml.tlb you'll > get "intellisense" for it. The WB.Document object > is the same as the IE document object. > > Document.Body.innerText is the text of the webpage. > Everything in the page is accessible through the DOM > in one way or another, but it's a vast object model and > some of it is poorly designed. It's not always easy to > figure out how to get exactly what you want to get. > Yup... That was what I was going to suggest. Get hold of the DOM document of the loaded page, and grab the outermost html element that wraps the data you're interested in. In your case (OP) its probably a table or a div that wraps the workorders. This should get you started: Add a webbrowser contols to a form, an add "Microsoft HTML Object Library" in references. '------------------- Option Explicit Dim m_Dom As MSHTML.HTMLDocument Private Sub Form_Load() WebBrowser1.Navigate2 "http://www.google.com/" End Sub Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) ' Get the dom document, and print the text-content Set m_Dom = pDisp.Document Debug.Print m_Dom.documentElement.innerText ' Grap a different interface to the dom to do some manipulation Dim dom As IHTMLDocument3 Set dom = m_Dom ' Fill google's search text box dom.getElementsByName("q")(0).Value = "Search for this" Debug.Print dom.getElementsByName("q")(0).Value End Sub '------------------- -- Dag.
|
Pages: 1 Prev: Packaging Program Next: Saving picture in VB6 |