Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1974
  • Last Modified:

GP Script to Open IE Window on Login

i'm using a vbscript to open IE to a particular webpage (our intranet page) when a user logs in. my problem is that not all users have their screen resolution set to 1024x768 which is what i've written the script to run best at. is there a simple way to get the window to size itself to the maximum available space? if not, what is the vbscript command to make the window startup maximized (not IE fullscreen since the users are unlikely to know how to close it)? the script i've written is:

dim ie
set ie=createobject("internetexplorer.application")

ie.navigate"http://intranet"
ie.toolbar=0
ie.statusbar=0
ie.Top=0
ie.Left=0
ie.Width=1024
ie.Height=740
ie.visible=true
0
craskin
Asked:
craskin
  • 3
  • 2
1 Solution
 
followingCommented:
You could try using ie.document.parentWindow.screen.width and ie.document.parentWindow.screen.height to set variables to the current resolution and then feed those into ie.Width and ie.Height.

I'll try to post an example shortly.

Hope this helps,
-jdm

0
 
followingCommented:
This should do the trick:

dim ie
set ie=createobject("internetexplorer.application")
ie.navigate"http://intranet"
ie.toolbar=0
ie.statusbar=0
ie.Top=0
ie.Left=0
ie.visible=true
ie.Width=ie.document.parentwindow.screen.availWidth
ie.Height=ie.document.parentwindow.screen.availHeight

Note: I used availWidth and availHeight in the example since that ensures that the ie object will not overlap the taskbar.

Hope this helps,
-jdm
0
 
craskinAuthor Commented:
generated error code 80004005.
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
followingCommented:
I think that's because we are trying to change properties before the object is fully instantiated.  Try this:

Dim ie
Set ie=createobject("internetexplorer.application")
With ie
    .navigate "about:blank"
    Do Until .readyState=4
      WScript.Sleep 10
    Loop
    .toolbar=0
    .statusbar=0
    .Top=0
    .Left=0
    .Width=ie.document.parentwindow.screen.availWidth
    .Height=ie.document.parentwindow.screen.availHeight
    .navigate "http://intranet"
    .visible=true
End With
0
 
craskinAuthor Commented:
excellent! it worked!
0
 
vicky1982Commented:
can you Please suggesth how can i set user default page set by them , script will not change thier page only it will open site which we want in the Last Line.

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now