From: MarceepooNu on 28 Jun 2010 22:27 Dear Tom: Here's the error message I get when I try to do what you suggested: strTitle = "Date String" MsgBox GetIEWindowText(strTitle) '''''''''''''''''''''''''''''''''''''''' Function GetIEWindowText(sTitle) Dim IE, stype For Each IE In CreateObject("Shell.Application").windows sType = typename(IE.document) if instr(sType,"htmldocument", 1, vbTextCompare) <> 0 then ' the next line triggers the following error message: 'Column: 1; Error: Object doesn't support this property or method: 'IE.document.title' 'Code: 800A01B6 ; Source: Microsoft VBScript runtime error if instr(IE.document.title, sTitle, 1, vbTextCompare) = 1 then GetIEWindowText = IE.document.innerText exit function end if end if Next end function ' GetIEWindowText I apologize for not being able to find the fix. I spent almost two hours trying, before I imposed on your time again by asking for more help. (I mention this so that you won't feel that I'm imposing on your time whimsically, i.e., I did try.) 1. When you post the fix, could you include some info about where I could learn why the solution works? 2. Is there a good book or url you can suggest where I could learn more about scripting Internet Explorer and how to use the DOM? I find IE scripting extraordinarily obscure, as compared with filesystemobject scripting, for which the documentation and tutorials seem much more accessible .... to me. I don't know where to go to learn that stuff. Thanks again, MarceepooNu -- MarceepooNu "Tom Lavedas" wrote: > On Jun 28, 2:35 pm, MarceepooNu <mbh2...(a)aol.com> wrote: > > I sometimes use the Sub (shown below) named: "subShowInHtmlWindow(strTexte)" > > to > > report the output from a script to an html window. > > > > I'd love to send an argument from script A to script B, and have Sript A > > harvest > > the output from Script B, and assign the output to a variable, for further > > computation. > > > > I came across the Sub (shown below) named: "subListTheContentsOfaWebPage", > > which > > would serve as a way to harvest Script B's output, if I could make Script B > > work properly where the Window has a "phony" url, i.e., "about:blank" > > > > If anyone has any ideas about how to "harvest" the contents of a hidden or > > "about blank" webpage, I'd appreciate it very much. > > > > Thank you for your time, consideration and effort, > > > > MarceepooNu > > {snip} > > Try something like this instead ... > > Function GetIEWindowText(sTitle) > Dim IE, stype > > For Each IE In CreateObject("Shell.Application").windows > sType = typename(IE.document) > if instr(sType,"htmldocument", 1, vbTextCompare) <> 0 then > if instr(IE.document.title, sTitle, 1, vbTextCompare) = 1 then > GetIEWindowText = IE.document.innerText > exit function > end if > end if > Next > > end function ' GetIEWindowText > > Just supply the title of IE window B, as created by Script B and it > will return the text found in that window at the time the request is > issued. For example, ... > > sText_B = GetIEWindowText("about:blank") > > It will return the contents of the first window it finds. If the > result is empty, the second window was not found. The window does NOT > have to be visible. > _____________________ > Tom Lavedas > . >
From: Mayayana on 28 Jun 2010 23:09 | Here's the error message I get when I try to do what you suggested: I think he just meant to give you "air code". You need to write the actual code yourself. For instance, this is a typo: instr(sType,"htmldocument", 1, vbTextCompare) It should be (1, sType,"htmldocument", 1) Note that vbTextCompare is meaningless unless you declare it as a variable or constant, so using that as you've written it would be interpreted as 0, which is binary comparison. If you can't remember that 0 is binary and 1 is text comparison then you need to declare those variables/constants at the top of all scripts. Are you sure that's what you need, though? I thought you wanted to pass data from script A to script B. For that you could just write a text file to disk. | | strTitle = "Date String" | MsgBox GetIEWindowText(strTitle) | '''''''''''''''''''''''''''''''''''''''' | Function GetIEWindowText(sTitle) | Dim IE, stype | | For Each IE In CreateObject("Shell.Application").windows | sType = typename(IE.document) | if instr(sType,"htmldocument", 1, vbTextCompare) <> 0 then | | ' the next line triggers the following error message: | 'Column: 1; Error: Object doesn't support this property or method: | 'IE.document.title' | 'Code: 800A01B6 ; Source: Microsoft VBScript runtime error | if instr(IE.document.title, sTitle, 1, vbTextCompare) = 1 then | GetIEWindowText = IE.document.innerText | exit function | end if | end if | Next | | end function ' GetIEWindowText | | | I apologize for not being able to find the fix. I spent almost two hours | trying, before I imposed on your time again by asking for more help. (I | mention this so that you won't feel that I'm imposing on your time | whimsically, i.e., I did try.) | | 1. When you post the fix, could you include some info about where I could | learn why the solution works? | | 2. Is there a good book or url you can suggest where I could learn more | about scripting Internet Explorer and how to use the DOM? I find IE | scripting extraordinarily obscure, as compared with filesystemobject | scripting, for which the documentation and tutorials seem much more | accessible .... to me. I don't know where to go to learn that stuff. | | | Thanks again, | | MarceepooNu | -- | MarceepooNu | | | "Tom Lavedas" wrote: | | > On Jun 28, 2:35 pm, MarceepooNu <mbh2...(a)aol.com> wrote: | > > I sometimes use the Sub (shown below) named: "subShowInHtmlWindow(strTexte)" | > > to | > > report the output from a script to an html window. | > > | > > I'd love to send an argument from script A to script B, and have Sript A | > > harvest | > > the output from Script B, and assign the output to a variable, for further | > > computation. | > > | > > I came across the Sub (shown below) named: "subListTheContentsOfaWebPage", | > > which | > > would serve as a way to harvest Script B's output, if I could make Script B | > > work properly where the Window has a "phony" url, i.e., "about:blank" | > > | > > If anyone has any ideas about how to "harvest" the contents of a hidden or | > > "about blank" webpage, I'd appreciate it very much. | > > | > > Thank you for your time, consideration and effort, | > > | > > MarceepooNu | > > {snip} | > | > Try something like this instead ... | > | > Function GetIEWindowText(sTitle) | > Dim IE, stype | > | > For Each IE In CreateObject("Shell.Application").windows | > sType = typename(IE.document) | > if instr(sType,"htmldocument", 1, vbTextCompare) <> 0 then | > if instr(IE.document.title, sTitle, 1, vbTextCompare) = 1 then | > GetIEWindowText = IE.document.innerText | > exit function | > end if | > end if | > Next | > | > end function ' GetIEWindowText | > | > Just supply the title of IE window B, as created by Script B and it | > will return the text found in that window at the time the request is | > issued. For example, ... | > | > sText_B = GetIEWindowText("about:blank") | > | > It will return the contents of the first window it finds. If the | > result is empty, the second window was not found. The window does NOT | > have to be visible. | > _____________________ | > Tom Lavedas | > . | >
From: ekkehard.horner on 29 Jun 2010 04:34 Mayayana schrieb: [...] > Note that vbTextCompare is meaningless unless you > declare it as a variable or constant, so using that as > you've written it would be interpreted as 0, which is > binary comparison. If you can't remember that 0 is binary > and 1 is text comparison then you need to declare > those variables/constants at the top of all scripts. >> WScript.Echo vbTextCompare, vbBinaryCompare, vbYes >> 1 0 6 *Some* constants are defined. [...]
From: Tom Lavedas on 29 Jun 2010 08:15 On Jun 28, 10:27 pm, MarceepooNu <mbh2...(a)aol.com> wrote: > Dear Tom: > > Here's the error message I get when I try to do what you suggested: > > strTitle = "Date String" > MsgBox GetIEWindowText(strTitle) > '''''''''''''''''''''''''''''''''''''''' > Function GetIEWindowText(sTitle) > Dim IE, stype > > For Each IE In CreateObject("Shell.Application").windows > sType = typename(IE.document) > if instr(sType,"htmldocument", 1, vbTextCompare) <> 0 then > > ' the next line triggers the following error message: > 'Column: 1; Error: Object doesn't support this property or method: > 'IE.document.title' > 'Code: 800A01B6 ; Source: Microsoft VBScript runtime error > if instr(IE.document.title, sTitle, 1, vbTextCompare) = 1 then > GetIEWindowText = IE.document.innerText > exit function > end if > end if > Next > > end function ' GetIEWindowText > > I apologize for not being able to find the fix. I spent almost two hours > trying, before I imposed on your time again by asking for more help. (I > mention this so that you won't feel that I'm imposing on your time > whimsically, i.e., I did try.) > > 1. When you post the fix, could you include some info about where I could > learn why the solution works? > > 2. Is there a good book or url you can suggest where I could learn more > about scripting Internet Explorer and how to use the DOM? I find IE > scripting extraordinarily obscure, as compared with filesystemobject > scripting, for which the documentation and tutorials seem much more > accessible .... to me. I don't know where to go to learn that stuff. > > Thanks again, > > MarceepooNu > -- > MarceepooNu > > "Tom Lavedas" wrote: > > On Jun 28, 2:35 pm, MarceepooNu <mbh2...(a)aol.com> wrote: > > > I sometimes use the Sub (shown below) named: "subShowInHtmlWindow(strTexte)" > > > to > > > report the output from a script to an html window. > > > > I'd love to send an argument from script A to script B, and have Sript A > > > harvest > > > the output from Script B, and assign the output to a variable, for further > > > computation. > > > > I came across the Sub (shown below) named: "subListTheContentsOfaWebPage", > > > which > > > would serve as a way to harvest Script B's output, if I could make Script B > > > work properly where the Window has a "phony" url, i.e., "about:blank" > > > > If anyone has any ideas about how to "harvest" the contents of a hidden or > > > "about blank" webpage, I'd appreciate it very much. > > > > Thank you for your time, consideration and effort, > > > > MarceepooNu > > > {snip} > > > Try something like this instead ... > > > Function GetIEWindowText(sTitle) > > Dim IE, stype > > > For Each IE In CreateObject("Shell.Application").windows > > sType = typename(IE.document) > > if instr(sType,"htmldocument", 1, vbTextCompare) <> 0 then > > if instr(IE.document.title, sTitle, 1, vbTextCompare) = 1 then > > GetIEWindowText = IE.document.innerText > > exit function > > end if > > end if > > Next > > > end function ' GetIEWindowText > > > Just supply the title of IE window B, as created by Script B and it > > will return the text found in that window at the time the request is > > issued. For example, ... > > > sText_B = GetIEWindowText("about:blank") > > > It will return the contents of the first window it finds. If the > > result is empty, the second window was not found. The window does NOT > > have to be visible. > > _____________________ > > Tom Lavedas Sorry. As Mayayana said, it was 'air code' and the error in the InStr() syntax is probably the whole problem with the routine. That is because it causes lines of code that should not be executed to be executed. Try the correct syntax and see if that fixes the problem ... Function GetIEWindowText(sTitle) Dim IE, stype For Each IE In CreateObject("Shell.Application").windows sType = typename(IE.document) if instr(1, sType,"htmldocument", vbTextCompare) <> 0 then if instr(1, IE.document.title, sTitle, vbTextCompare) = 1 then GetIEWindowText = IE.document.innerText exit function end if end if Next end function ' GetIEWindowText Regarding information on using IE DOM, this is the reference I use, though it is not particularly tutorial, it is useful, sometimes: http://msdn.microsoft.com/en-us/library/ms533050(VS.85).aspx ________________________ Tom Lavedas
From: Tom Lavedas on 29 Jun 2010 09:06 On Jun 29, 8:15 am, Tom Lavedas <tglba...(a)verizon.net> wrote: > On Jun 28, 10:27 pm, MarceepooNu <mbh2...(a)aol.com> wrote: > > > > > Dear Tom: > > > Here's the error message I get when I try to do what you suggested: > > > strTitle = "Date String" > > MsgBox GetIEWindowText(strTitle) > > '''''''''''''''''''''''''''''''''''''''' > > Function GetIEWindowText(sTitle) > > Dim IE, stype > > > For Each IE In CreateObject("Shell.Application").windows > > sType = typename(IE.document) > > if instr(sType,"htmldocument", 1, vbTextCompare) <> 0 then > > > ' the next line triggers the following error message: > > 'Column: 1; Error: Object doesn't support this property or method: > > 'IE.document.title' > > 'Code: 800A01B6 ; Source: Microsoft VBScript runtime error > > if instr(IE.document.title, sTitle, 1, vbTextCompare) = 1 then > > GetIEWindowText = IE.document.innerText > > exit function > > end if > > end if > > Next > > > end function ' GetIEWindowText > > > I apologize for not being able to find the fix. I spent almost two hours > > trying, before I imposed on your time again by asking for more help. (I > > mention this so that you won't feel that I'm imposing on your time > > whimsically, i.e., I did try.) > > > 1. When you post the fix, could you include some info about where I could > > learn why the solution works? > > > 2. Is there a good book or url you can suggest where I could learn more > > about scripting Internet Explorer and how to use the DOM? I find IE > > scripting extraordinarily obscure, as compared with filesystemobject > > scripting, for which the documentation and tutorials seem much more > > accessible .... to me. I don't know where to go to learn that stuff. > > > Thanks again, > > > MarceepooNu > > -- > > MarceepooNu > > > "Tom Lavedas" wrote: > > > On Jun 28, 2:35 pm, MarceepooNu <mbh2...(a)aol.com> wrote: > > > > I sometimes use the Sub (shown below) named: "subShowInHtmlWindow(strTexte)" > > > > to > > > > report the output from a script to an html window. > > > > > I'd love to send an argument from script A to script B, and have Sript A > > > > harvest > > > > the output from Script B, and assign the output to a variable, for further > > > > computation. > > > > > I came across the Sub (shown below) named: "subListTheContentsOfaWebPage", > > > > which > > > > would serve as a way to harvest Script B's output, if I could make Script B > > > > work properly where the Window has a "phony" url, i.e., "about:blank" > > > > > If anyone has any ideas about how to "harvest" the contents of a hidden or > > > > "about blank" webpage, I'd appreciate it very much. > > > > > Thank you for your time, consideration and effort, > > > > > MarceepooNu > > > > {snip} > > > > Try something like this instead ... > > > > Function GetIEWindowText(sTitle) > > > Dim IE, stype > > > > For Each IE In CreateObject("Shell.Application").windows > > > sType = typename(IE.document) > > > if instr(sType,"htmldocument", 1, vbTextCompare) <> 0 then > > > if instr(IE.document.title, sTitle, 1, vbTextCompare) = 1 then > > > GetIEWindowText = IE.document.innerText > > > exit function > > > end if > > > end if > > > Next > > > > end function ' GetIEWindowText > > > > Just supply the title of IE window B, as created by Script B and it > > > will return the text found in that window at the time the request is > > > issued. For example, ... > > > > sText_B = GetIEWindowText("about:blank") > > > > It will return the contents of the first window it finds. If the > > > result is empty, the second window was not found. The window does NOT > > > have to be visible. > > > _____________________ > > > Tom Lavedas > > Sorry. As Mayayana said, it was 'air code' and the error in the > InStr() syntax is probably the whole problem with the routine. That > is because it causes lines of code that should not be executed to be > executed. Try the correct syntax and see if that fixes the > problem ... > > Function GetIEWindowText(sTitle) > Dim IE, stype > > For Each IE In CreateObject("Shell.Application").windows > sType = typename(IE.document) > if instr(1, sType,"htmldocument", vbTextCompare) <> 0 then > if instr(1, IE.document.title, sTitle, vbTextCompare) = 1 then > GetIEWindowText = IE.document.innerText > exit function > end if > end if > Next > > end function ' GetIEWindowText > > Regarding information on using IE DOM, this is the reference I use, > though it is not particularly tutorial, it is useful, sometimes:http://msdn.microsoft.com/en-us/library/ms533050(VS.85).aspx > ________________________ > Tom Lavedas Sorry, there's still one more error. This line ... GetIEWindowText = IE.document.innerText should read ... GetIEWindowText = IE.document.body.innerText ________________________ Tom Lavedas
|
Next
|
Last
Pages: 1 2 3 Prev: VBScript to add local accounts on multiple machines Next: CLICK AND GET $1000 TO YOUR HOME. |