Hi !
I have an html page that contains a button. When the button is pressed a VBScript function is called. This function is supposed to open 2 new windows. 1 is Windows Explorer preset to a folder, and the other is an application called Domino.Doc Neighborhood. As you can see from the code, I need to user wsh.Run to open the neighborhood using the CLSID as parameter. This is the only way I know how to open this window. I use ShellExecute to open the Windows Explorer.
The problem starts when I want to resize the windows. I create an Shell.Application object and an object containing all the windows in this Shell.Application object. Then I use the Item property and Item.LocationName to find the windows i want to resize.
The problem is that it seems to me that the I need to create the Shell one more time after opening the windows to be able to find them..
Might be wrong on this..
Then, when setting Shell.Application.Windows it doesn't find the Domino.Doc Neightborhood window.
HERE'S THE CODE:
HTML Code:
<HTML>
<HEAD>
<TITLE>Start Domino.Doc</TITLE>
<SCRIPT LANGUAGE="VBScript">
<!--
dim wsh
function OpenNeighborhood()
set wsh = CreateObject("WScript.Shell")
wsh.Run("Explorer.exe /e,/root,::{0140D981-D707-11D2-9D18-00104B952FEE}")
set wsh = nothing
//need to put in a delay
for i=0 to 1500000
next
end function
function SetNewShell()
//need to put in a delay
for i=0 to 1500000
next
set wsh = CreateObject("WScript.Shell")
end function
function fnShellWindowsItemVB()
dim objShell
dim objShellWindows
call OpenNeighborhood()
set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "Explorer.exe", " /e,C:\Test\Scanned Files", "", "open", 1
set objShell = nothing
call SetNewShell()
set objShell = CreateObject("Shell.Application")
set objShellWindows = objShell.Windows
if (not objShellWindows is nothing) then
dim objIE
for i=0 to objShellWindows.Count-1
set objIE = objShellWindows.Item(i)
//alert(objIE.LocationName)
if (not objIE is nothing) then
if objIE.LocationName="Domino.Doc Neighborhood" then
//alert(objIE.LocationName)
objIE.Width=screen.width/2
objIE.Height=screen.height-30
objIE.Left=0
objIE.Top=0
end if
if objIE.LocationName="Scanned Files" then
//alert(objIE.LocationName)
objIE.Width=screen.width/2
objIE.Height=screen.height-30
objIE.Left=screen.width/2
objIE.Top=0
end if
end if
next
set objIE = nothing
end if
set objShellWindows = nothing
set objShell = nothing
set wsh = nothing
end function
-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="button" value="Start Domino.Doc" onclick="fnShellWindowsItemVB()">
</BODY>
</HTML>
Does anyone have any comments, tips on why this code doesn't work properly ??
PS: This is my first piece of VBScript code...
Sincerely,
Petter Kjeilen