Sign in to follow this  
Followers 0
Guest Ryan

Automating Internet Explorer (problems)

2 posts in this topic

Hi All,

Yet another Noob on the forums. AutoIT has been great. I'm not sure of the limitations of this great platform, but I'm hoping to get some tips from the experts on the possibility of automating a windows update. (Yes, I know I could use SUS, but right now that's not an option).

I read through the forums and saw post asking how to tell if a webpage was finished loading - Larry had suggested using a While loop checking the text of the Status bar. Unfortunately, when I run WinUpdate, it doesn't always report the corret text in the status bar.

Another suggestion in that post was to use the PixelGetColor function to see if the page stopped loading by looking at the color of the "Stop" icon in IE. Yet another problem - for some reasons, even when pages are finished loading, the Stop button never changes color...

I've also tried using the WinWait function and wait until it sees a specific piece of text on the webpage, but this doesn't seem to work either... (I'm guessing it can't look for HTML text?)

Any ideas on how to get this working?

Here's my bit of code:

$MSWIN="http://v4.windowsupdate.microsoft.com/en/default.asp"

Run ('explorer.exe '& $MSWIN)
WinWait("Microsoft Windows Update - Microsoft Internet Explorer")
WinSetState ( "Microsoft Windows Update - Microsoft Internet Explorer", "", @SW_MAXIMIZE)

;This was Larry's suggestion...
$nSure = 0
While $nSure < 80
   If StatusBarGetText("Microsoft Windows Update - Microsoft Internet Explorer") == "Done" Then
        $nSure=$nSure+1
   Else
        $nSure=0
   EndIf
Wend
Sleep(4000)


;This was another forum member's suggestion...
; $pixcolor = PixelGetColor(145, 68)
; MsgBox(0,"The decmial color is", $pixcolor)
; While $pixcolor = 79103
;  Sleep(1000)
; WEND  

Send("+{TAB 6}")
Send("{ENTER}")
Sleep(12000)
Send("+{TAB 5}")
Send("{ENTER}")
Sleep(8000)
Send("{TAB 26}")
;Send("{ENTER"})

WinWaitActive("Microsoft Internet Explorer")
ControlClick("Microsoft Internet Explorer", "", "Button2")
Send("!{F4}")

;Finished

Share this post


Link to post
Share on other sites



I did this just the other day. It only works in 1024x768 and I have no been able to test it fully as there have been no updates in the past couple days but_should_work. See if any of thise code works for you.

$SITE = "http://www.windowsupdate.com"
Run ('C:\Program Files\Internet Explorer\IEXPLORE.EXE '& $SITE)
WinWait("Microsoft Windows Update")
WinShow("Microsoft Windows Update", "", @SW_MAXIMIZE)
MouseMove(340,360)

$nSure = 0 
While $nSure = 0
   If StatusBarGetText("Microsoft Windows Update") == "javascript:parent.fnScan();" Then
        WinShow("Microsoft Windows Update", "", @SW_MAXIMIZE)
        MouseClick("left", 340, 360)
        $nSure=$nSure+1
   Else
        $nSure=0
   EndIf
Wend

$nSure = 0 
While $nSure = 0
    WinShow("Microsoft Windows Update", "", @SW_MAXIMIZE)
    MouseMove(235,400)
    MouseMove(225,400)
    WinShow("Microsoft Windows Update", "", @SW_MAXIMIZE)
   If StatusBarGetText("Microsoft Windows Update") == "http://v4.windowsupdate.microsoft.com/en/" Then
        WinShow("Microsoft Windows Update", "", @SW_MAXIMIZE)
        MouseClick("left", 100, 420)
        $nSure=$nSure+1
   Else
        $nSure=0
   EndIf
Wend


$nSure = 0

While $nSure = 0
    $var = PixelGetColor(358, 380)
   If $var == "16643572" Then
    ProcessClose("Ad-watch.exe")
        WinShow("Microsoft Windows Update", "", @SW_MAXIMIZE)
        MouseClick("left", 358, 380)
        MouseMove(330,350)
         $nSure2 = 0 
  While $nSure2 = 0
  WinShow("Microsoft Windows Update", "", @SW_MAXIMIZE)
     If StatusBarGetText("Microsoft Windows Update") == "javascript:parent.fnDisplayHistory();" Then
          WinClose("Microsoft Windows Update")
          Send("#u")
          Sleep(1000)
          Send("r")
          Send("{ENTER}")
          $nSure2=$nSure2+1
     Else
          $nSure2=0
     EndIf
  Wend
        
        $nSure=$nSure+1
   Else 
   If $var == "15593969" Then
    WinClose("Microsoft Windows Update")
    Sleep(300)
    Exit
   EndIf
        $nSure=0
   EndIf
Wend



Exit

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0