DELETED_3139

Associate
Joined
18 Oct 2002
Posts
2,154
Location
Leicester, UK
Hi,

Your CreateIE Sub routine is wrong. You cannot use Screen.Width in VBS. You should not use On Error Resume Next either. If you had not used this you would have realised there was an error. :)

To get the screen size as you intend to do you first fully need to load IE and navigate to a web page. Then you can the screen size through IE using .document.parentwindow.scree.height or width.

Here is your script fixed. How it worked before I have no idea. :)

Code:
'Create IE Display Window

Sub CreateIE()

    With CreateObject("InternetExplorer.Application")
	'We need to navigate first.
	.navigate wshLogonPath & "\logon.htm"

	'Wait until the page has fully loaded.
  	Do while .Busy
            Wscript.Sleep 700
        Loop

    	'Ok page has loaded, set perameters.
    	.height = 520
    	.width = 380
	.resizable=0
    	.menubar=0
    	.toolbar=0
    	.statusBar=0
    	.visible=1

	'Now page has loaded and peramenters are set we can now move the window using .document.parentwindow.screen to get screen size etc...
    	.Top = (.document.parentWindow.screen.height / 2) - 260
    	.Left = (.document.parentWindow.screen.width / 2) - 190
    End With
End Sub
TrUz
 
Associate
Joined
26 Sep 2003
Posts
834
Location
essex
I've had a quick look but didn't see anything obvious. Best thing to do is to debug it yourself by putting in some msgboxes.

I would put some msgbox in strategic places to help you narrow down the error. (You can always kill the vbscript once in a loop - wscript.exe is the process)

if not, I'm sure someone else will be able to help....
 
Associate
Joined
18 Oct 2002
Posts
2,154
Location
Leicester, UK
Looking over it I cannot see anything obvious and I cannot test it all for you as I am not on your network. :)

Best thing to do is remove all On Error Resume Next... I am going to say it will break and it will tell ou what line the error is on etc...

EDIT: My bad, try this. I didn't create the Object as IE and just noticed you use IE elsewhere in you script.

Code:
Sub CreateIE()

  Set IE = CreateObject("InternetExplorer.Application")

  With IE
    .navigate wshLogonPath & "\logon.htm"

    Do while .Busy
      ' wait for page to load
      Wscript.Sleep 700
    Loop

    .resizable=0
    .height = 520
    .width = 380

    .Top = (.document.parentWindow.screen.height / 2) - 260
    .Left = (.document.parentWindow.screen.width / 2) - 190

    .menubar=0
    .toolbar=0
    .statusBar=0
    .visible=1
  End With
End Sub
TrUz
 
Last edited:
Back
Top Bottom