UAC & Internetexplorer.Application

Wednesday, February 18, 2009 by sViz | Discussion: DesktopX

Okay, so it was all smooth sailing until I had a friend test out a gadget; then things got complicated.

Simple Script:

Code: vbscript
  1. Sub Object_OnScriptEnter
  2.  Set objExplorer = CreateObject("InternetExplorer.Application")
  3.  objExplorer.Navigate "about:blank"
  4.  objExplorer.ToolBar = 0
  5.  objExplorer.StatusBar = 1
  6.  objExplorer.Width = 300
  7.  objExplorer.Height = 150
  8.  objExplorer.Left = 0
  9.  objExplorer.Top = 0
  10.  objExplorer.Visible = 1
  11. End Sub

Long story short: I have UAC turned off, so it worked fine. But with my friend's UAC turned on, it won't allow the gadget to set any of iexplorer properties. It'll open iexplorer all right and navigate to the url, but I really need the window to open in a specific size or I might as well forget the function altogether. Can't expect the end-user to turn off their UAC just for this gadget, and I haven't seen any way to get Vista to allow the script.

I'd use DX ActiveX web browser, but the site I'm navigating to uses shockwave flash, and, with UAC turned on, it crashes DXBuilder before Vista can ask for permission to run the site.

It's the first time I'm doing a really internet-intensive gadget and I'm finding UAC to be a royal pain.

 

Any workarounds or ideas?

Vad_M
Reply #1 Wednesday, February 18, 2009 2:19 AM

I'm not sure that this will solve all of your problems. However I use the same method to work with WMI. So look below please:

 

1. Write your IE script and save it as a text file (myie.vbs). For example:

  Dim objExplorer
  

  Set objExplorer = CreateObject("InternetExplorer.Application")
    objExplorer.ToolBar = 0
    objExplorer.StatusBar = 1
    objExplorer.Width = 300
    objExplorer.Height = 150
    objExplorer.Left = 0
    objExplorer.Top = 0
    objExplorer.Navigate "about:blank"
    objExplorer.Visible = 1

etc......

2. Add this file to the "Custom files" of your main object (on the bottom of the object "Summary" tab)

3. Add this code into your DX script and try to run it:

 Sub Object_OnScriptEnter
  Dim objWSH
  Set objWSH = CreateObject("Shell.Application")
   objWSH.ShellExecute  "cscript.exe", Chr(34) & object.Directory&"myie.vbs" & Chr(34),"", "runas", 0
   If err.number > 0 Then err.clear
  Set objWSH = nothing
End Sub

By this way your script will run with Administrator rights and UAC will not be able to disturb you.

Best Regards.

P.S. Vista UAC is not a royal pain. This is a big Microsoft's Shame!

P.P.S. Don't use this code for XP!!! It for Vista only!!!

 

 

superman
Reply #2 Wednesday, February 18, 2009 5:09 AM

Great Master!

sViz
Reply #3 Wednesday, February 18, 2009 1:44 PM

Thank you! Thank you! Thank you, Vad!    It works brilliantly.  You are awesome.

superman
Reply #4 Wednesday, February 18, 2009 2:13 PM

Vad_M = Vad Master

Me right, master?

Vad_M
Reply #5 Wednesday, February 18, 2009 3:11 PM

Vad_M = Vad Master

Alas this is not right. I just skiped one character in my name.

sViz,

Not at all!  I'm glad to see that it helped you.

Please login to comment and/or vote for this skin.

Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:

  • Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
  • Access to a great community, with a massive database of many, many areas of interest.
  • Access to contests & subscription offers like exclusive emails.
  • It's simple, and FREE!



web-wc01