From: MarceepooNu on

I tried running the vbscript example For the ShellWindows.Item Method, as
posted
at http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
But I get an error message:
Line: 16 Error: ActiveX component can't create object:
'shell.Shell_Application'
Code: 800A01AD Source: Microsoft VBScript runtime error

I'm trying to run the example in Vista 64 Bit.
If anybody has any suggestions about where I could learn what I'm doing
wrong, I'd appreciate it very much.
thanks again,
marceepoo

Here's the code....
(P.S. Does anyone know why there are no postings showing today in
"Discussions in Internet Explorer Scripting"? Is it being closed down?)

MsgBox fnShellWindowsItemVB

function fnShellWindowsItemVB()
'http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
'ShellWindows.Item Method
dim objShell
dim objShellWindows
Dim strIEpath

set objShell = CreateObject("shell.Shell_Application")
set objShellWindows = objshell.Shell_Windows

if (not objShellWindows is nothing) then
dim objIE
set objIE = objShellWindows.Item

if (not objIE is nothing) then
'alert(objIE.path)
strIEpath = objIE.path
end if

set objIE = nothing
end if

set objShellWindows = nothing
set objShell = nothing
end function

--
MarceepooNu
From: Mayayana on
That's a strange code sample. There seem to be errors in it.
The following should work. I fixed the ProgID and the way you
were accessing Item.


fnShellWindowsItemVB

Sub fnShellWindowsItemVB()
Dim objShell
Dim objShellWindows

Set objShell = CreateObject("shell.Application")
Set objShellWindows = objShell.Windows
If objShellWindows.count > 0 Then
MsgBox objShellWindows.item(0).path
Else
MsgBox "No windows open."
End If
Set objShellWindows = Nothing
Set objShell = Nothing
End Sub

Note that ShellWindows is a funky object model, due to
the original design for Active Desktop. Each item is in
theory an IE instance. But ShellWindows actually returns
all IE and open folder (Explorer) windows. You can tell
the difference with this:

TypeName(objShellWindows.item(0).document)

In the case of IE the document is an actual webpage document,
but in the case of Explorer the document is a ShellFolderView,
which is an automation wrapper around the folder's ListView
window.

|
| I tried running the vbscript example For the ShellWindows.Item Method, as
| posted
| at http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
| But I get an error message:
| Line: 16 Error: ActiveX component can't create object:
| 'shell.Shell_Application'
| Code: 800A01AD Source: Microsoft VBScript runtime error
|
| I'm trying to run the example in Vista 64 Bit.
| If anybody has any suggestions about where I could learn what I'm doing
| wrong, I'd appreciate it very much.
| thanks again,
| marceepoo
|
| Here's the code....
| (P.S. Does anyone know why there are no postings showing today in
| "Discussions in Internet Explorer Scripting"? Is it being closed down?)
|
| MsgBox fnShellWindowsItemVB
|
| function fnShellWindowsItemVB()
| 'http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
| 'ShellWindows.Item Method
| dim objShell
| dim objShellWindows
| Dim strIEpath
|
| set objShell = CreateObject("shell.Shell_Application")
| set objShellWindows = objshell.Shell_Windows
|
| if (not objShellWindows is nothing) then
| dim objIE
| set objIE = objShellWindows.Item
|
| if (not objIE is nothing) then
| 'alert(objIE.path)
| strIEpath = objIE.path
| end if
|
| set objIE = nothing
| end if
|
| set objShellWindows = nothing
| set objShell = nothing
| end function
|
| --
| MarceepooNu


From: MarceepooNu on
Wow!! Thank you. I'm replying before I even work with the code you shared
with me because I'm kind of under pressure to move forward w/a project.
1. Where can I get some education about the "TypeName" thingee? I actually
spent 1/2 hour or an hour or more (I don't recall exactly) trying to find
more documentation than I found at the MDSN page entitled "Type Property"
located at:
http://msdn.microsoft.com/en-us/library/aa752081(v=VS.85).aspx
2. I'm trying to use one function to do three things:
(i) find windows satisfying the condition: If left(window.LocationUrl, 5) <>
"file:
and
(ii) within the group of windows satisfying condition (i), find windows
having certain text in "IE.document.body.innerText"

By the way, (to display my confusion and ignorance), I presume that all
windows satisfying condition (i) will also satisfy this condition: If
InStr(1, sType,"htmldocument", vbTextCompare) <> 0
But I really don't understand how to get from here to there, or there to
here. I'm kind of lost.

Lastly, my goal is to make a vbscript's arguments function as though they
could be used byVal or byRef (by sending the information back to the calling
script through a hidden window with a specific title, that the calling script
can use to identify the hidden window containing the return info, which the
calliing script will harvest from the hidden window, and then terminate the
hidden window (to avoid overloading the system with too many open windows.).
whew!

Thank you so much for what you sent me.

marceepoo


--
MarceepooNu


"Mayayana" wrote:

> That's a strange code sample. There seem to be errors in it.
> The following should work. I fixed the ProgID and the way you
> were accessing Item.
>
>
> fnShellWindowsItemVB
>
> Sub fnShellWindowsItemVB()
> Dim objShell
> Dim objShellWindows
>
> Set objShell = CreateObject("shell.Application")
> Set objShellWindows = objShell.Windows
> If objShellWindows.count > 0 Then
> MsgBox objShellWindows.item(0).path
> Else
> MsgBox "No windows open."
> End If
> Set objShellWindows = Nothing
> Set objShell = Nothing
> End Sub
>
> Note that ShellWindows is a funky object model, due to
> the original design for Active Desktop. Each item is in
> theory an IE instance. But ShellWindows actually returns
> all IE and open folder (Explorer) windows. You can tell
> the difference with this:
>
> TypeName(objShellWindows.item(0).document)
>
> In the case of IE the document is an actual webpage document,
> but in the case of Explorer the document is a ShellFolderView,
> which is an automation wrapper around the folder's ListView
> window.
>
> |
> | I tried running the vbscript example For the ShellWindows.Item Method, as
> | posted
> | at http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
> | But I get an error message:
> | Line: 16 Error: ActiveX component can't create object:
> | 'shell.Shell_Application'
> | Code: 800A01AD Source: Microsoft VBScript runtime error
> |
> | I'm trying to run the example in Vista 64 Bit.
> | If anybody has any suggestions about where I could learn what I'm doing
> | wrong, I'd appreciate it very much.
> | thanks again,
> | marceepoo
> |
> | Here's the code....
> | (P.S. Does anyone know why there are no postings showing today in
> | "Discussions in Internet Explorer Scripting"? Is it being closed down?)
> |
> | MsgBox fnShellWindowsItemVB
> |
> | function fnShellWindowsItemVB()
> | 'http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
> | 'ShellWindows.Item Method
> | dim objShell
> | dim objShellWindows
> | Dim strIEpath
> |
> | set objShell = CreateObject("shell.Shell_Application")
> | set objShellWindows = objshell.Shell_Windows
> |
> | if (not objShellWindows is nothing) then
> | dim objIE
> | set objIE = objShellWindows.Item
> |
> | if (not objIE is nothing) then
> | 'alert(objIE.path)
> | strIEpath = objIE.path
> | end if
> |
> | set objIE = nothing
> | end if
> |
> | set objShellWindows = nothing
> | set objShell = nothing
> | end function
> |
> | --
> | MarceepooNu
>
>
> .
>
From: MarceepooNu on
Whoops.
I meant...

2. I'm trying to use one function to do three things:
(i) and (ii): Find windows satisfying the conditions:
For Each window in sa.windows
If left(window.LocationUrl, 5) <> "file:" Then
' logic for selecting windows goes here
If window.locationUrl = "about:blank" Then
and
(iii) within the group of windows satisfying conditions (i) and (ii), find
windows
having certain text (e.g., "Boopsie") in "IE.document.body.innerText"

Sorry for the typo.



--
MarceepooNu


"MarceepooNu" wrote:

>
> I tried running the vbscript example For the ShellWindows.Item Method, as
> posted
> at http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
> But I get an error message:
> Line: 16 Error: ActiveX component can't create object:
> 'shell.Shell_Application'
> Code: 800A01AD Source: Microsoft VBScript runtime error
>
> I'm trying to run the example in Vista 64 Bit.
> If anybody has any suggestions about where I could learn what I'm doing
> wrong, I'd appreciate it very much.
> thanks again,
> marceepoo
>
> Here's the code....
> (P.S. Does anyone know why there are no postings showing today in
> "Discussions in Internet Explorer Scripting"? Is it being closed down?)
>
> MsgBox fnShellWindowsItemVB
>
> function fnShellWindowsItemVB()
> 'http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
> 'ShellWindows.Item Method
> dim objShell
> dim objShellWindows
> Dim strIEpath
>
> set objShell = CreateObject("shell.Shell_Application")
> set objShellWindows = objshell.Shell_Windows
>
> if (not objShellWindows is nothing) then
> dim objIE
> set objIE = objShellWindows.Item
>
> if (not objIE is nothing) then
> 'alert(objIE.path)
> strIEpath = objIE.path
> end if
>
> set objIE = nothing
> end if
>
> set objShellWindows = nothing
> set objShell = nothing
> end function
>
> --
> MarceepooNu
From: MarceepooNu on
Hi again. (I'm like a bad penny.) I did some research and here's where I'm
stymied again.
The 3d msgbox generates an error message as follows:
Object doesn't support this property or method:
'objShellWindows.item(...).document.documentElement'
Code: 800A01B6
Source: Microsoft VBScript runtime error

Why does it generate that error message? I copied
"document.documentElement.innerHTML" directly from
http://msdn.microsoft.com/en-us/library/ms533739(v=VS.85).aspx

What am I doing wrong?

Thanks for reading thru all this.

Marceepoo


fnShellWindowsItemVB

Sub fnShellWindowsItemVB()
Dim objShell
Dim objShellWindows

Set objShell = CreateObject("shell.Application")
Set objShellWindows = objShell.Windows
If objShellWindows.count > 0 Then
MsgBox "Path: " & objShellWindows.item(0).path
MsgBox "LocationURL: " & objShellWindows.item(0).LocationURL
'documentElement Property
'http://msdn.microsoft.com/en-us/library/ms533739(v=VS.85).aspx
MsgBox objShellWindows.item(0).document.documentElement.innerHTML
Else
MsgBox "No windows open."
End If
Set objShellWindows = Nothing
Set objShell = Nothing
End Sub


--
MarceepooNu


"Mayayana" wrote:

> That's a strange code sample. There seem to be errors in it.
> The following should work. I fixed the ProgID and the way you
> were accessing Item.
>
>
> fnShellWindowsItemVB
>
> Sub fnShellWindowsItemVB()
> Dim objShell
> Dim objShellWindows
>
> Set objShell = CreateObject("shell.Application")
> Set objShellWindows = objShell.Windows
> If objShellWindows.count > 0 Then
> MsgBox objShellWindows.item(0).path
> Else
> MsgBox "No windows open."
> End If
> Set objShellWindows = Nothing
> Set objShell = Nothing
> End Sub
>
> Note that ShellWindows is a funky object model, due to
> the original design for Active Desktop. Each item is in
> theory an IE instance. But ShellWindows actually returns
> all IE and open folder (Explorer) windows. You can tell
> the difference with this:
>
> TypeName(objShellWindows.item(0).document)
>
> In the case of IE the document is an actual webpage document,
> but in the case of Explorer the document is a ShellFolderView,
> which is an automation wrapper around the folder's ListView
> window.
>
> |
> | I tried running the vbscript example For the ShellWindows.Item Method, as
> | posted
> | at http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
> | But I get an error message:
> | Line: 16 Error: ActiveX component can't create object:
> | 'shell.Shell_Application'
> | Code: 800A01AD Source: Microsoft VBScript runtime error
> |
> | I'm trying to run the example in Vista 64 Bit.
> | If anybody has any suggestions about where I could learn what I'm doing
> | wrong, I'd appreciate it very much.
> | thanks again,
> | marceepoo
> |
> | Here's the code....
> | (P.S. Does anyone know why there are no postings showing today in
> | "Discussions in Internet Explorer Scripting"? Is it being closed down?)
> |
> | MsgBox fnShellWindowsItemVB
> |
> | function fnShellWindowsItemVB()
> | 'http://msdn.microsoft.com/en-us/library/bb773970(v=VS.85).aspx
> | 'ShellWindows.Item Method
> | dim objShell
> | dim objShellWindows
> | Dim strIEpath
> |
> | set objShell = CreateObject("shell.Shell_Application")
> | set objShellWindows = objshell.Shell_Windows
> |
> | if (not objShellWindows is nothing) then
> | dim objIE
> | set objIE = objShellWindows.Item
> |
> | if (not objIE is nothing) then
> | 'alert(objIE.path)
> | strIEpath = objIE.path
> | end if
> |
> | set objIE = nothing
> | end if
> |
> | set objShellWindows = nothing
> | set objShell = nothing
> | end function
> |
> | --
> | MarceepooNu
>
>
> .
>